Skip to content

Commit 96808cc

Browse files
committed
deleting mode added to DuplicateChecker
1 parent 20793dc commit 96808cc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

DuplicateChecker/DuplicateChecker.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
s_folder: Path = None
1313
dirs: list = None
1414
moddir: Path = None
15+
delete_mode: bool = False
1516

1617

1718
def print_info(message):
@@ -49,6 +50,10 @@ def Settings():
4950
exit()
5051
else:
5152
cfg_path = Path("./settings.json")
53+
54+
global delete_mode
55+
56+
delete_mode = "-d" in argv
5257

5358

5459

@@ -145,6 +150,17 @@ def CheckDuplicates(folder):
145150
for fl in p_filelist: # We'll always iterate by the primary pathlist files
146151
if fl in s_filelist:
147152
print_info(f"[Duplicate] {fl}")
153+
154+
if delete_mode:
155+
print_warning("Are you sure you want to delete these files?")
156+
input("Press Ctrl+C or close the window to cancel, otherwise, proceeding to delete.")
157+
for fl in p_filelist:
158+
if fl in s_filelist:
159+
delpath: Path = s_path / fl
160+
print(f"[Deleting] {delpath}")
161+
delpath.unlink(missing_ok=True)
162+
163+
148164

149165

150166
def main():

0 commit comments

Comments
 (0)