-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathcleardcp.py
More file actions
30 lines (24 loc) · 992 Bytes
/
cleardcp.py
File metadata and controls
30 lines (24 loc) · 992 Bytes
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
# cleardcp.py
# This script removes all files from `decensor_input', `decensor_input_original' and `decensor_output' directories.
# Originally written by github.com/DioKyrie
#
import os
from typing import Union
def clear_folder(folder_path: Union[str, bytes]) -> None:
try:
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
if os.path.isfile(file_path):
os.remove(file_path)
elif os.path.isdir(file_path):
clear_folder(file_path)
print(f"Content of '{folder_path}' cleared successfully.")
except Exception as e:
print(f"Error clearing content of '{folder_path}': {e}")
def main():
folders_to_clear = ["decensor_input", "decensor_input_original", "decensor_output"]
for folder in folders_to_clear:
folder_path = os.path.join(os.path.dirname(__file__), folder)
clear_folder(folder_path)
if __name__ == "__main__":
main()