Created
July 27, 2016 11:59
-
-
Save python-consulting/d5b6a658e746c814df74ac6431606757 to your computer and use it in GitHub Desktop.
os walk tree
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
import os | |
from os.path import join, getsize | |
for root, dirs, files in os.walk('python/Lib/email'): | |
print root, "consumes", | |
print sum(getsize(join(root, name)) for name in files), | |
print "bytes in", len(files), "non-directory files" | |
if 'CVS' in dirs: | |
dirs.remove('CVS') # don't visit CVS directories |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment