Skip to content

Instantly share code, notes, and snippets.

@roablep
Forked from bobhancockgist/gist:5490527
Created May 14, 2013 17:51
Show Gist options
  • Save roablep/5577999 to your computer and use it in GitHub Desktop.
Save roablep/5577999 to your computer and use it in GitHub Desktop.
import os
# Assign your top level directory to home
home = "/Users/rhancock"
for dirpath, dirs, files in os.walk(home, topdown=True):
for dr in dirs:
fullpath_d = os.path.join(dirpath, dr)
for fname in os.listdir(fullpath_d):
# do something with the file here, I just printed the name.
print(os.path.join(fullpath_d, fname))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment