Skip to content

Commit

Permalink
Initial report
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Nov 11, 2024
1 parent d46ea44 commit a4b44f9
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions .github/scripts/du.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,16 @@ def prepare_report(directory):
for user, data in report.items():
data["disk_usage_human_readable"] = bytes_to_human_readable(data["disk_usage_bytes"])

# os.makedirs(os.path.dirname(OUTPUT_FILE), exist_ok=True)
# output_file =
# with open(OUTPUT_FILE, 'w') as f:
# json.dump(report, f, indent=4)
#
# print(f"Disk usage report generated at {os.path.abspath(OUTPUT_FILE)}")
os.makedirs(os.path.dirname(OUTPUT_DIR), exist_ok=True)
current_date = date.today().strftime('%Y-%m-%d')
with open(f"{OUTPUT_DIR}/{current_date}.json", "w") as f:
json.dump(report, f, indent=4)
print(f"Disk usage report generated at {os.path.abspath(OUTPUT_FILE)}")


if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: du.py <directory_to_check>")
else:
path = sys.argv[1]
directories = [d for d in os.listdir(path) if os.path.isdir(os.path.join(path, d))]

os.makedirs(os.path.dirname(OUTPUT_DIR), exist_ok=True)
current_date = date.today().strftime('%Y-%m-%d')
with open(f"{OUTPUT_DIR}/{current_date}.json", "w") as f:
f.write("\n".join(directories))
# prepare_report(directory)
prepare_report(path)

0 comments on commit a4b44f9

Please sign in to comment.