Created
July 8, 2018 17:57
-
-
Save sbalaji6/79eb51a0dd0c361a6287c5a159a73e5f 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(rootdir='.', pattern='*'): | |
"""Search recursively for files matching a specified pattern. | |
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python | |
""" | |
matches = [] | |
for root, dirnames, filenames in os.walk(rootdir): | |
for filename in fnmatch.filter(filenames, pattern): | |
matches.append(os.path.join(root, filename)) | |
return matches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment