From e322e47a8c8ccb82c7fa1521dbf61215c2f0b450 Mon Sep 17 00:00:00 2001 From: Joren Date: Sun, 9 Mar 2025 17:27:51 +0100 Subject: [PATCH] Fix it removing the renamed file --- deduper.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/deduper.sh b/deduper.sh index ddbb23b..d5c70cd 100755 --- a/deduper.sh +++ b/deduper.sh @@ -87,9 +87,15 @@ find . -type f -regextype posix-extended -regex ".*\([0-9]\)\.flac" | while read mv "$best_file" "$orig_file" fi fi - + filtered_candidates=() for file in "${candidates[@]}"; do + if [[ "$file" != "$best_file" && "$file" != "$orig_file" ]]; then + filtered_candidates+=("$file") + fi + done + + for file in "${filtered_candidates[@]}"; do if [[ "$file" != "$best_file" ]]; then log " * Would delete: $file" if $ARMED; then @@ -98,9 +104,10 @@ find . -type f -regextype posix-extended -regex ".*\([0-9]\)\.flac" | while read fi done + + echo "" | tee -a "$LOGFILE" done -log "Cleanup completed at $(date)" - +log "Cleanup completed at $(date)" \ No newline at end of file