Created
February 23, 2017 16:16
-
-
Save guestl/38daf604acc8d7d52536e2834e3e3fc2 to your computer and use it in GitHub Desktop.
Scan directories list
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
def get_file_list_in_dir(dir_name, ext_list): | |
result_list = [] | |
tree = os.walk(dir_name) | |
i = 0 | |
logging.debug('get_file_list_in_dir(). dir_name is %s' % (dir_name)) | |
for d, dirs, files in tree: | |
for file in files: | |
filename, file_extension = os.path.splitext(file) | |
if file_extension and file_extension in ext_list: | |
path = os.path.join(d, file) | |
result_list.append(path) | |
show_wait("Scaning ", i) | |
i += 1 | |
show_wait("Scaning ", -1) | |
return result_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment