advertisement

Find Code  Advanced Search   

browse free vb code
Submit Code
ASP,  HTML, and XML
Database
Dates  and Math
Files  and Directories
Forms  and Controls
Lists,  Collections, and Arrays
Miscellaneous
Multimedia/Games
Office/VBA
Network/Internet
Registry
Screen/Graphics
String  Manipulation
System/API
Windows  2000/XP
VB.NET/ASP.NET



advertisement
Nested File Search With Wildcards using File System Object

Author: Ethan (Featured Developer)
Category: System/API
Type: Applications
Difficulty: Intermediate

Version Compatibility:  Visual Basic 6  

More information: The attached code shows how to locate files in a directory using the FileSystemObject. You can search just within the specified directory or include all subdirectories in the search.

Even though the FileSystemObject doesn't allow for wildcard symbols, I included code that shows how to use the wildcard symbol to help in locating a group of files. This allows you to do nested file searches with wildcards without using the Dir function or the FindFirstFile/FindNextFile API calls, which many peopele find confusing.

"Test.bmp" will only return that file if found. "*.frm" will return all files that end in ".frm" and "Test*" will return all files that start with "Test". In addition, semi-colon separation of search strings is supported, so *.txt;*.exe will return all file with a .txt or .exe extension.

Also included is an exampe of using the SendMessage API function to add a horizontal scroll bar dynamically to a list box.

NOTE: The Microsoft Scripting Runtime must be referenced to access the FileSystemObject.

This code has been viewed 81551 times.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

code/LocFiles.zip

Sponsored Links

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs