Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions radarr_dupefinder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

directory=${1:-.} # Use provided directory or default to current directory

find "$directory" -type d | while read -r dir; do
file_count=$(find "$dir" -maxdepth 1 -type f \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.wmv" -o -iname "*.flv" -o -iname "*.webm" -o -iname "*.mpg" -o -iname "*.mpeg" \) | wc -l)
if [[ $file_count -gt 1 ]]; then
echo "$dir"
fi
done
33 changes: 33 additions & 0 deletions sonarr_dupefinder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

directory=${1:-.} # Use provided directory or default to current directory

find "$directory" -type d | while read -r dir; do
# Extract all matching filenames in the directory
files=($(find "$dir" -maxdepth 1 -type f -regextype posix-extended \
\( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.wmv" -o -iname "*.flv" -o -iname "*.webm" -o -iname "*.mpg" -o -iname "*.mpeg" \) \
-regex ".*\([0-9]{4}\).*S[0-9]{2}E([0-9]{2}).*" | sed -E 's/.*E([0-9]{2}).*/\1/'))

# Count occurrences of each episode number
declare -A ep_count
for ep in "${files[@]}"; do
((ep_count[$ep]++))
done

# Check if any episode appears more than once
matched=0
for count in "${ep_count[@]}"; do
if [[ $count -gt 1 ]]; then
matched=1
break
fi
done

# Print the directory if it has matching files
if [[ $matched -eq 1 ]]; then
echo "$dir"
fi

# Clear the associative array for the next directory
unset ep_count
done
Loading