Created
October 31, 2010 04:38
-
-
Save andrewlkho/656133 to your computer and use it in GitHub Desktop.
Recursively search a specified path for matching files. This is the pythonic equivalent of `find /path -name '*.html'`
This file contains hidden or 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 os.path | |
import fnmatch | |
results = [] | |
for root, dirs, files in os.walk("/path"): | |
results.extend([os.path.join(root, file) for file in files | |
if fnmatch.fnmatch(file, "*.html")]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment