Answers for "os"

0

os

import os
total_size = 0
start_path = '.'  # To get size of current directory
for path, dirs, files in os.walk(start_path):
    for f in files:
        fp = os.path.join(path, f)
        total_size += os.path.getsize(fp)
print("Directory size: " + str(total_size))
Posted by: Guest on June-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language