Find all filenames in a directory tree that match a shell wildcard pattern
(filepat, top)
| 5 | import re |
| 6 | |
| 7 | def gen_find(filepat, top): |
| 8 | ''' |
| 9 | Find all filenames in a directory tree that match a shell wildcard pattern |
| 10 | ''' |
| 11 | for path, dirlist, filelist in os.walk(top): |
| 12 | for name in fnmatch.filter(filelist, filepat): |
| 13 | yield os.path.join(path, name) |
| 14 | |
| 15 | def gen_opener(filenames): |
| 16 | ''' |