import os
def get_size(start_path = '.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
print get_size()
import os
sum(os.path.getsize(f) for f in os.listdir('.') if os.path.isfile(f))
./20170706-1352-cet-how-to-get-directory-size-with-python-2.png