This function walks a directory tree starting at a specified root folder, and returns a list of all of the files (and optionally folders) that match our pattern(s).

d returns a list of all of the files (and optionally folders) that match our pattern(s).

The standard match our tree function os.path.walk can be confusing, and is difficult to customize. It can also be slow. Here’s an alternative that allows you to choose the root folder, whether to recurse down through sub-folders, the file pattern to match, and whether to include folder names in the results.

The file pattern is case insensitive and UNIX style. Multiple patterns may be specified; delimit with a semi-colon. Note that this means semi-colons themselves can’t be part of a pattern. Boo-hoo.


Download from: Homepage




Author:
admin
Time:
Wednesday, June 11th, 2008 at 8:41 am
Category:
Uncategorized
Comments:
You can leave a response, or trackback from your own site.
RSS:
You can follow any responses to this entry through the RSS 2.0 feed.
Navigation:

Leave a Reply