Last active
August 29, 2015 14:01
-
-
Save Lukse/e4f5559cfc4aba829e03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import fnmatch | |
def recursive_glob(treeroot, pattern): | |
results = [] | |
for base, dirs, files in os.walk(treeroot): | |
goodfiles = fnmatch.filter(files, pattern) | |
results.extend(os.path.join(base, f) for f in goodfiles) | |
return results | |
print recursive_glob('c:/', '*.txt') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment