|
-
Aug 22nd, 2000, 04:18 AM
#1
Thread Starter
Member
hi, (yeah i know this is my second article, but i'm submitting a tip instead of a question so it shouldn't count 
i'm working for a company that asked me to write a pice of software to find avrious bits of information on there computers, this program (informant) would be run every time a pc logges on.
the most difficult thing about my information gathering program is to search the hard disk for installed applications... it would be too slow if i had my program to search the disk about 20 times, so here's what i came up with (you'll need NT or DOS 6, NOT 7):
first run the command
"c:\winnt\system32\tree.com /f /a C:\ > c:\temp\temp.dat"
and then load the temp.dat and:
do until eof #1
lineput #1, strTempVar
If Frountpg = False Then Frountpg = InStr(1, ttemp, _
"frountpg.exe")
loop
this serachs for frount page. this may not be very ifficiant for seraching one program, but as the numbers of file you are searching for expand, then it would become more and more efficent, because your are only making on pass through the tree file.
if took my about 50 seconds to run through 9300 lines on a Pentium 133 with 128 mb of RAM searching for 10 files 
if you could think of a more efficient way please reply to this articles :-), all comments welcome..
Zhang, again
Thanx, for your reply(s)
Zhang Tian Hao
Visual Studio Enterprise 6.0 SP 4
[email protected]
-
Aug 28th, 2002, 06:02 PM
#2
Lively Member
Cache and DIR
On most systems, the file table would be cached after the first time you searched it and therefore the search would go much faster on subsequent searches, so I'm not sure this would be any faster, have you tested it?
Aside from that, I think you can get the same result (a list of files) from the ubiquitous DIR command, like this:
Code:
dir /s /b C: > C:\temp\temp.dat
/s means to search subdirectories, and /b means bare format (just file paths and names only). If you want to filter out directories or certain file types, use the /a command, which can look for (or exclude) certain types of files. To filter out directories, do this:
Code:
dir /a-d /s /b C: > C:\temp\temp.dat
The minus D excludes directories.
-JoeyCode
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|