Recursive File Search (as a module)

Category:
Files and Directories
Type:
Modules
Difficulty:
Intermediate

Author: Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This function uses the API to search directories and (optionally) all its subdirectories for files, and adds the files to a list view control. Originally programmed and designed by Stefan and the original is on this site at http://www.freevbcode.com/ShowCode.Asp?ID=822 This version just encapsulates the code into a module with the ability to add its files to any listview (you pass the listview object to the function). Very minor changes made, Kudos to Stefan for a recursive file search that rocks! Please note: to speed up the recursive search make your listview box invisible before you call the recursive function and then make it visible again after. This prevents the repainting of the listbox everytime you add something. It improves the speed by over 200%.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: