load_folder_files: support passing in folder list

This commit is contained in:
debugtalk
2017-09-22 19:04:29 +08:00
parent 8d2d52b192
commit eaf080212c
2 changed files with 24 additions and 2 deletions

View File

@@ -65,6 +65,16 @@ def load_folder_files(folder_path, recursive=True):
folder_path: specified folder path to load
recursive: if True, will load files recursively
"""
if isinstance(folder_path, (list, set)):
files = []
for path in set(folder_path):
files.extend(load_folder_files(path, recursive))
return files
if not os.path.exists(folder_path):
return []
file_list = []
for dirpath, dirnames, filenames in os.walk(folder_path):