-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
27 lines (22 loc) · 794 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import shutil
def clean_temp_files():
temp_folder = "/tmp"
if os.path.exists(temp_folder):
print(f"Geçici dosyalar temizleniyor: {temp_folder}")
for root, _, files in os.walk(temp_folder):
for file in files:
file_path = os.path.join(root, file)
try:
os.remove(file_path)
except Exception as e:
print(f"Hata: {e}")
trash_folder = os.path.expanduser("~/.local/share/Trash/files")
if os.path.exists(trash_folder):
print(f"Çöp dosyaları temizleniyor: {trash_folder}")
try:
shutil.rmtree(trash_folder)
except Exception as e:
print(f"Hata: {e}")
print("Temizleme tamamlandı.")
clean_temp_files()