Well, I always wondered the scope of Python and Finally Realised it is limitless. The following script named “DirectorySize.py” is written in python 3.x
The following python script has following properties
- requires python 3.x to run
- Tell the size of directory in which it is placed
- Tested on Unix(MacOs and Ubuntu)
- But should also work on windows *Try, test, run and then write your own And I forgot something, Hello everyone :-)
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))