Last active
September 23, 2019 00:47
-
-
Save TzuChiehHung/76fdcde9daf3ab4d1bd95897b9b072ed to your computer and use it in GitHub Desktop.
[Get a filtered file list in a directory] #python
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 | |
from fnmatch import fnmatch | |
for path, _, files in os.walk('root/dir'): | |
for filename in files: | |
if fnmatch(filename, 'match_pattern'): | |
print(os.path.join(path, filename)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment