Update app.py
Browse files1234567891011import osfrom pathlib import Pathtotal = sum(f.stat().st_size for f in Path("/data/matches").rglob("*") if f.is_file())print(f"/data/matches: {total / 1024**3:.2f} GB")total2 = sum(f.stat().st_size for f in Path("/data/by-language").rglob("*") if f.is_file())print(f"/data/by-language: {total2 / 1024**3:.2f} GB")total3 = sum(f.stat().st_size for f in Path("/data/image-shards").rglob("*") if f.is_file())print(f"/data/image-shards: {total3 / 1024**3:.2f} GB")123456789101112131415161718192021222324252627282930import osdef safe_size(root):total = 0for 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 caseif os.path.islink(path):continuetotal += os.path.getsize(path)except OSError:continuereturn totalpaths = ["/data/matches","/data/by-language","/data/image-shards"]for p in paths:size = safe_size(p)print(f"{p}: {size / 1024**3:.2f} GB")
app.py+26-7