Bucket / app.py
Neon-tech's picture
Rename app.p to app.py
6830d6a verified
raw
history blame contribute delete
624 Bytes
import os
def safe_size(root):
total = 0
for dirpath, dirnames, filenames in os.walk(root, followlinks=False):
for f in filenames:
try:
path = os.path.join(dirpath, f)
# skip broken symlinks just in case
if os.path.islink(path):
continue
total += os.path.getsize(path)
except OSError:
continue
return total
paths = [
"/data/matches",
"/data/by-language",
"/data/image-shards"
]
for p in paths:
size = safe_size(p)
print(f"{p}: {size / 1024**3:.2f} GB")