Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_all_files(folder, files=[]):
- all_content = [os.path.join(folder, i) for i in os.listdir(folder)]
- # list files in current folder
- files += [i for i in all_content if os.path.isfile(i)]
- subfolders = [i for i in all_content if os.path.isdir(i)]
- for f in subfolders:
- get_all_files(f)
- return files
- all_files = get_all_files(r"E:\Photos")
- for f in all_files:
- print(f)
Advertisement
Add Comment
Please, Sign In to add comment