Files
bin/tvshow_prune
rozbrian 304cbcc554 update
2026-01-10 20:46:22 +09:00

31 lines
848 B
Bash
Executable File

#!/bin/bash
# Function to process files
process_files() {
local pattern="$1"
shift
local replacements=("$@")
for file in *"$pattern"*; do
echo "==== $file ===="
for replacement in "${replacements[@]}"; do
local new_name="${file/$pattern/$replacement}"
if [ -e "$new_name" ]; then
echo "$new_name to be removed!"
rm "$new_name"
else
echo "$new_name NOT found"
fi
done
done
}
# Process 720p files
process_files "720p-NEXT" "720p.H264-F1RST" "720p-NICE" "720p.WANNA"
# Process 1080p files with 1080p.H264-F1RST
process_files "1080p.H264-F1RST" "1080p-NICE" "1080p.WANNA" "720p-NEXT"
# Process 1080p files with 1080p-NEXT
process_files "1080p-NEXT" "720p-NEXT" "1080p.H264-F1RST" "1080p-NICE" "1080p.WANNA"