the fastest way to retrieve all directories on a drive?

Posted on 1997-08-22
Last Modified: 2012-06-21
Whould you tell me the FASTEST way to retrieve all directories on a drive.Is there any API function or something else that can help me? I use recursively call of Dir$ function but it takes 20s for ~13000 files and ~900 folders. Please help! (I've VB5.0 Enterprise Edition)
Question by:polygon
  • 2

Accepted Solution

wolfcrag earned 30 total points
ID: 1431903
The solution is to use FindFirstFile and FindNextFile API functions. They can also be used to find directories, not only files. It's a little bit long to describe here, but a beautiful example is on the following web page:

If for some reason this URL doesn;t work, go to:

and search for directory. The article is entitled: "Drive, Folder & File Property Page Demo"

Expert Comment

ID: 1431904

Expert Comment

ID: 1431905
Dear wolfrag,
Your answer is excellent.Thanks.
If you know something else that can help me you may email me at:

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question