Last active
June 13, 2019 16:36
-
-
Save wlizama/cb3771eb4be296d1983f53fc5fd21636 to your computer and use it in GitHub Desktop.
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 fnmatch | |
import os | |
MY_DIR = 'Q:\\my_dir\\sub_dir' | |
FILE_EXT = 'xml' | |
def filter_files_by_ext(dir, filter_ext): | |
files = [file for file in os.listdir(dir) if fnmatch.fnmatch(file, '*.%s' % filter_ext)] | |
return files | |
def execute(): | |
print(filter_files_by_ext(MY_DIR, FILE_EXT)) | |
if __name__ == "__main__": | |
execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment