Last active
August 29, 2015 14:23
-
-
Save denkiwakame/20472b5700164d3c8931 to your computer and use it in GitHub Desktop.
grep filepath recursively
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 | |
from fnmatch import fnmatch | |
def get_fpath_list(dirpath, ext="*.xlsx"): | |
fpath_list = [] | |
for root, dir_list, fname_list in os.walk(dirpath): | |
fpath_list.extend([ os.path.join(root,fname) for fname in fname_list if fnmatch(fname, ext)]) | |
return fpath_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment