Customized Recursive File Search

Files and Directories
The Anchoret

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
APIs are used here to search directories, optionally all its subdirectories, and add the files to a list view control. Originally programmed and designed by Stefan at, then encapsulated into a module by Anonymous at I took Anonymous’ version and made it work with wildcards, i.e. with this code you can search for something like *blabla.*. As the anonymous submission described, this version just encapsulates the code into a module with the ability to add its files to any listview control by passing the listview object to the function. 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 every time you add something. It improves the speed by over 200%. You might want to move the two Screen.MousePointer = 11&1 lines from the above subroutine to your calling code, just to avoid the mouse flicking. Thanks to both Stefan and Anonymous.

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