Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebaad91

Browse files
author
Jared Manning
committed
REVERT 83432b9
I'm not sure how to revert this other than like this. My apologies for commit that crap.
1 parent 57f7f0a commit ebaad91

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

folder_size.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@
1313
directory = '.' # Set the variable directory to be the current directory
1414
dir_size = 0 # Set the size to 0
1515

16-
def main():
17-
for (path, dirs, files) in os.walk(directory): # Walk through all the directories
18-
for file in files: # Get all the files
19-
filename = os.path.join(path, file)
20-
dir_size += os.path.getsize(filename) # Get the sizes, the following lines print the sizes in bytes, Kb, Mb and Gb
21-
print "Folder Size in Bytes = %0.2f Bytes" % (dir_size)
22-
print "Folder Size in Kilobytes = %0.2f KB" % (dir_size/1024.0)
23-
print "Folder Size in Megabytes = %0.2f MB" % (dir_size/1024/1024.0)
24-
print "Folder Size in Gigabytes = %0.2f GB" % (dir_size/1024/1024/1024.0)
25-
26-
if __name__ == '__main__':
27-
main()
16+
for (path, dirs, files) in os.walk(directory): # Walk through all the directories
17+
for file in files: # Get all the files
18+
filename = os.path.join(path, file)
19+
dir_size += os.path.getsize(filename) # Get the sizes, the following lines print the sizes in bytes, Kb, Mb and Gb
20+
print "Folder Size in Bytes = %0.2f Bytes" % (dir_size)
21+
print "Folder Size in Kilobytes = %0.2f KB" % (dir_size/1024.0)
22+
print "Folder Size in Megabytes = %0.2f MB" % (dir_size/1024/1024.0)
23+
print "Folder Size in Gigabytes = %0.2f GB" % (dir_size/1024/1024/1024.0)

0 commit comments

Comments
 (0)