Skip to content

Instantly share code, notes, and snippets.

@asus4
Created May 30, 2017 15:17
Show Gist options
  • Save asus4/03f82fe441b40e4319b13fe97f516265 to your computer and use it in GitHub Desktop.
Save asus4/03f82fe441b40e4319b13fe97f516265 to your computer and use it in GitHub Desktop.
Find specific extension files in directory (python)
def fild_files(directory, file_ext):
''' Find specific extension files in the folder '''
for root, dirs, files in os.walk(directory):
for file in files:
_, ext = os.path.splitext(file)
if ext == '.' + file_ext:
yield os.path.join(root, file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment