mirror of
https://github.com/kevinveenbirkenbach/duplicate-file-handler.git
synced 2024-11-22 14:01:03 +01:00
Optimized modes
This commit is contained in:
parent
c2566a355d
commit
7c4010c59e
6
main.py
6
main.py
@ -22,8 +22,8 @@ def find_duplicates(directories):
|
|||||||
|
|
||||||
def handle_modification(files, modification, mode, apply_to):
|
def handle_modification(files, modification, mode, apply_to):
|
||||||
if mode == 'preview':
|
if mode == 'preview':
|
||||||
if modification == 'show':
|
if modification == 'delete':
|
||||||
print("Would show the following duplicate files:")
|
print("Would delete the following duplicate files:")
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.startswith(tuple(apply_to)):
|
if file.startswith(tuple(apply_to)):
|
||||||
print(file)
|
print(file)
|
||||||
@ -57,10 +57,8 @@ def main(args):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for file_hash, files in duplicates.items():
|
for file_hash, files in duplicates.items():
|
||||||
if args.mode == 'preview' or (args.mode == 'interactive' and args.modification == 'show'):
|
|
||||||
print(f"Duplicate files for hash {file_hash}:")
|
print(f"Duplicate files for hash {file_hash}:")
|
||||||
[print(file) for file in files if file.startswith(tuple(apply_to))]
|
[print(file) for file in files if file.startswith(tuple(apply_to))]
|
||||||
else:
|
|
||||||
handle_modification(files, args.modification, args.mode, apply_to)
|
handle_modification(files, args.modification, args.mode, apply_to)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user