Skip to content

Instantly share code, notes, and snippets.

@geoffalday
Created May 3, 2012 10:28
Show Gist options
  • Save geoffalday/2584913 to your computer and use it in GitHub Desktop.
Save geoffalday/2584913 to your computer and use it in GitHub Desktop.
Get files from directory
#via http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
import fnmatch
import os
matches = []
for root, dirnames, filenames in os.walk('src'):
for filename in fnmatch.filter(filenames, '*.c'):
matches.append(os.path.join(root, filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment