forked from jbachurski/cpp-algorithmics-delta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.py
More file actions
18 lines (17 loc) · 653 Bytes
/
cleanup.py
File metadata and controls
18 lines (17 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os, glob, time
mem = {"kB": 1024, "MB": 1024**2}
M = 0
ctime = time.time()
for a in sorted(glob.glob("**/*", recursive=True), key=os.path.getsize):
size = os.path.getsize(a)
date = os.path.getmtime(a)
minutes, days = round((ctime - date)/60, 2), round((ctime - date)/(60*60*24), 2)
print(f"{a} | {size} | {minutes}min = {days}d")
M += size
if days > 30 and (a.endswith(".o") or a.endswith(".exe")):
prompt = "y"#input("Remove? (y for True): ")
if prompt == "y":
os.remove(a)
print("---")
print(f"M = {M}B = {round(M/mem['kB'], 2)}kB = {round(M/mem['MB'], 2)}MB")
os.system("pause")