Skip to content

Instantly share code, notes, and snippets.

@toast38coza
Created June 21, 2012 11:22
Show Gist options
  • Save toast38coza/2965200 to your computer and use it in GitHub Desktop.
Save toast38coza/2965200 to your computer and use it in GitHub Desktop.
Recursively find all files that end with a certain extension with subdirectories
# hat-tip: Sven Marnach
# http://stackoverflow.com/questions/5817209/browse-files-and-subfolders-in-python
htmlfiles = [os.path.join(root, name)
for root, dirs, files in os.walk(path)
for name in files
if name.endswith((".html", ".htm"))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment