Thursday, September 15, 2005

[VBScript] Helping out with wildcarded directory searches

At Emulate The Dir Command Via Vbscript... ( Vbscript ) Christian D'heureuse had written a ListDir Function to list files using wildcards. Someone else wanted filtration and another suggested regular expressions. The following works a little faster than the latter and gives fine control over what is acceptable and what is not.

The following collects all the files to a comma delimited list (you may want to put it in an array).
I then used this function to do the filtration and tied it all together as below (this is cut from a project file and the ellipses indicate code removed.) The inclusions and exclusions are handled through arrays, and in my project these were drawn from .ini files, a part of which is recorded below This all ran fairly fast and is better for speed than a regular expression mechanism, albeit at the cost of code size.

No comments: