Skip to content

Instantly share code, notes, and snippets.

@andrewlkho
Created October 31, 2010 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlkho/656133 to your computer and use it in GitHub Desktop.
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'`
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