Hi, I'm having issue displaying all immediate folder size and total size calculation from a directory path.
import os
from pathlib import Path
root='/dbfs/mnt/datalake/Persistent/Internal/'
size = 0
for path, subdirs, files in os.walk(root):
for f in Path(root).iterdir():
if name in files:
if f.is_dir():
size+=os.path.getsize(os.path.join(path, name))
dirSize = size/(1024*1024)
print(f, "--Size:", dirSize)
print("Directory size=", dirSize/(1024*1024))
What am I doing wrong ?
import os
from pathlib import Path
root='/dbfs/mnt/datalake/Persistent/Internal/'
size = 0
for path, subdirs, files in os.walk(root):
for f in Path(root).iterdir():
if name in files:
if f.is_dir():
size+=os.path.getsize(os.path.join(path, name))
dirSize = size/(1024*1024)
print(f, "--Size:", dirSize)
print("Directory size=", dirSize/(1024*1024))
What am I doing wrong ?