Skip to content

Instantly share code, notes, and snippets.

@samredai
Created November 21, 2019 18:25
Show Gist options
  • Save samredai/c9b6ca0b54cc10d9c6bdb714def31bc1 to your computer and use it in GitHub Desktop.
Save samredai/c9b6ca0b54cc10d9c6bdb714def31bc1 to your computer and use it in GitHub Desktop.
Python: Recursively list all subfolders and files in a directory
import os
for root, dirs, files in os.walk(".", topdown=False):
for name in files:
print(os.path.join(root, name))
for name in dirs:
print(os.path.join(root, name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment