mike23415 commited on
Commit
b95f309
·
verified ·
1 Parent(s): d0feaf5

Delete cleanup.py

Browse files
Files changed (1) hide show
  1. cleanup.py +0 -20
cleanup.py DELETED
@@ -1,20 +0,0 @@
1
- import os
2
- import time
3
-
4
- FOLDER = "/tmp"
5
- MAX_AGE_MINUTES = 60
6
-
7
- def clean_old_files(folder=FOLDER, max_age=MAX_AGE_MINUTES):
8
- now = time.time()
9
- for f in os.listdir(folder):
10
- path = os.path.join(folder, f)
11
- if os.path.isfile(path):
12
- if now - os.path.getmtime(path) > max_age * 60:
13
- try:
14
- os.remove(path)
15
- print(f"[Cleanup] Deleted: {path}")
16
- except Exception as e:
17
- print(f"[Cleanup Error] {e}")
18
-
19
- if __name__ == "__main__":
20
- clean_old_files()