Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

the fastest way to retrieve all directories on a drive?

Posted on 1997-08-22
3
Medium Priority
?
180 Views
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)
0
Comment
Question by:polygon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
wolfcrag earned 120 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:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=341

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

http://www.planet-source-code.com/vb/default.htm

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

Expert Comment

by:msiman
ID: 1431904
0
 
LVL 2

Expert Comment

by:msiman
ID: 1431905
Dear wolfrag,
Your answer is excellent.Thanks.
If you know something else that can help me you may email me at:
billy@sliven.osf.acad.bg
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

670 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