This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
delete-old-file.py
74 lines (48 loc) · 1.61 KB
/
delete-old-file.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
from glob import glob
from os import path
# delete all remaining file in the system
# def delete_old_input_file():
# # remove file if old file exist ---
# old_file = "input\*.png"
# try:
# for name in glob(old_file):
# os.remove(name)
# print("Old file removed. : " + str(name))
# except Exception as e:
# print("Error! " + str(e) + '\n')
def delete_old_output_file():
# remove file if old file exist ---
old_file = "output\*.png"
try:
for name in glob(old_file):
os.remove(name)
print("Old file removed. : " + str(name))
except Exception as e:
print("Error! " + str(e) + '\n')
def delete_old_denoised_file():
# remove file if old file exist ---
old_file = "output\denoise\*.png"
try:
for name in glob(old_file):
os.remove(name)
print("Old denoise file removed. : " + str(name))
except Exception as e:
print("Error! " + str(e) + '\n')
def delete_user_output():
# remove file if old file exist ---
old_file = "user-output\*.png"
try:
for name in glob(old_file):
os.remove(name)
print("Old user output file removed. : " + str(name))
except Exception as e:
print("Error! " + str(e) + '\n')
if __name__ == "__main__":
print("Starting to remove all old file(s).")
# delete old remaining file
#delete_old_input_file()
delete_old_output_file()
delete_old_denoised_file()
delete_user_output()
print("All old file(s) removed.")