Files
troupe-standup/wizard-work/spark/scratch_analyzer.py

40 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""Quick scratch directory analyzer - processes /root/.hermes/wizard-outputs/spark/."""
import json
import os
from pathlib import Path
def analyze_scratch():
output_dir = Path("/root/.hermes/wizard-outputs/spark")
stats = {
"directory": str(output_dir),
"files": [],
"total_files": 0,
"total_bytes": 0,
"file_types": {}
}
for f in output_dir.iterdir():
if f.is_file():
size = f.stat().st_size
ext = f.suffix or "(no extension)"
stats["files"].append({
"name": f.name,
"path": str(f),
"bytes": size,
"extension": ext
})
stats["total_files"] += 1
stats["total_bytes"] += size
stats["file_types"][ext] = stats["file_types"].get(ext, 0) + 1
# Sort files by name
stats["files"].sort(key=lambda x: x["name"])
return stats
if __name__ == "__main__":
stats = analyze_scratch()
with open("/root/.hermes/wizard-outputs/spark/scratch_analysis.json", "w") as f:
json.dump(stats, f, indent=2)
print(json.dumps(stats, indent=2))