Created
June 19, 2018 08:20
-
-
Save GenevieveBuckley/e11a3c4043797f9ccaa2172847793aeb to your computer and use it in GitHub Desktop.
Find files matching a specific file extension, via recursive search through input directory.
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
def find_filenames(input_directory, file_extension): | |
"""Return list of filenames matching file extension.""" | |
filelist = [] | |
for root, _, files in os.walk(input_directory): | |
for file in files: | |
if file.endswith(file_extension): | |
filename = os.path.join(root, file) | |
filelist.append(filename) | |
return filelist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment