Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quickest way to do a file scan in subdirectories?

Status
Not open for further replies.

BobTheMad

Programmer
Jun 11, 1999
81
US
I have a situation where I need to extract a bunch of filenames (and their full path) from a folder tree where the files exist least 3 levels deep.

-RootDir
-SubDir1
-SubDir2
-FileName

I created a FileSystemObject recursive call that will get me what I need, but it is very slow. Especially since I am dealing with 100K+ filenames

Is there a faster way?

Thought for the day: Beware of Gods who cannot laugh...
 
A somewhat indirect method is to shell out to a command line window and run a command such as:

dir /s /b mytopfolder >MyResults.txt

and then read MyResults.txt

The dos commands are very, very quick.

I tried this on my C:\Windows folder and it only tool about 10 seconds

 
bbofin: I thought of this method as well, but it seemed a little inelegant. However if it ends up being the best way (the quickest), the I will end up utilizing it.

Thanks!

Thought for the day: Beware of Gods who cannot laugh...
 

BobTheMad, this has been covered several times. See my comments and strongm's comments in this thread222-838004

Good Luck

 
Look in the FAQs, and I'd recommend an API approach. My FAQ on FolderSize could be easily adapted for your needs.

mmilan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top