Skip to content

Instantly share code, notes, and snippets.

@azhar22k
Created June 30, 2016 10:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azhar22k/72bfad7e37df5059eea6ced2c1e7341c to your computer and use it in GitHub Desktop.
Save azhar22k/72bfad7e37df5059eea6ced2c1e7341c to your computer and use it in GitHub Desktop.
The following script tells the size of directory in which it is run. Tested on Unix but should also work with with Windows
import os
totalSize = 0
for filename in os.listdir(os.getcwd()):
if not os.path.isfile(os.path.join(os.getcwd(),filename)):
continue
totalSize = totalSize + os.path.getsize(os.path.join(os.getcwd(),filename))
print("Total Size of current working directory is {0:.2f} Kilo bytes".format(totalSize/1024))
@azhar22k
Copy link
Author

The following script tells the size of directory in which it is run. Tested on Unix but should also work with with Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment