Created
May 24, 2017 14:02
-
-
Save 223n/2955ca7bf96ac1a796f8f6ab3ed41396 to your computer and use it in GitHub Desktop.
Python3で指定したフォルダのサイズをry
This file contains 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 | |
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(start_path = '\\\\fileServer1\\documents')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment