Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search a file in a harddisk...
Message
From
25/01/1999 01:43:43
 
 
To
25/01/1999 01:23:46
Aaron K. Y. Chu
Health & Care Co. Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00179711
Message ID:
00179714
Views:
24
>How to search a file in a harddisk for its subdirectories?
>
>LOCFILE() can only locate files in default and 'pathed' directory.
>I need to search all over the harddisk.

There are at least a couple of ways, all of which require a bit of coding to use. The most obvious approach is the use of ADIR() to build an array containing the directory hierarchy of a drive, and then checking each folder found to see if the file you want is available. Unless your directory hierarchy is static while your program is running, you need to build the list and traverse it each time you want to do a file search; if your directory hierarchy is fixed, build the list once at the first invocation, and save it to be used again later.

The same thing can be done traversing the folder hierarchy of a drive by invoking the NameSpace method of Automation object Shell.Application to get a folder object, and then traversing the collections of the contained Folder Objects. If you do this a lot and your drive hierarchy isn't static, I'd seriously consider using the Automation Object.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform