This handy little utility determines the size of a folder and it's subfolders in MBytes.
Size of a File Folder/Directory (Python)
# determine size of a given folder in MBytes
import os
# pick a folder you have ...
folder = 'D:\\zz1'
folder_size = 0
for (path, dirs, files) in os.walk(folder):
for file in files:
filename = os.path.join(path, file)
folder_size += os.path.getsize(filename)
print "Folder = %0.1f MB" % (folder_size/(1024*1024.0))
nirav200_patel 0 Newbie Poster
ilovepython1978 0 Newbie Poster
l77 0 Newbie Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
Arun Mittal 0 Newbie Poster
kostas89 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.