Last active
January 31, 2025 00:00
-
-
Save acouvreur/25f90a605307705cd71c9399fa7eb5b8 to your computer and use it in GitHub Desktop.
Sync deleted files from Radarr/Sonarr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find existing files in download/complete that are not in movies or tvshows. | |
export DOWNLOAD_FOLDER=path/to/downloads | |
export MOVIES_FOLDER=path/to/movies | |
export TVSHOWS_FOLDER=path/to/tvshows | |
findExistingFile() { | |
file=$(find $MOVIES_FOLDER/ $TVSHOWS_FOLDER/ -samefile "$1") | |
if [ -z "$file" ]; then | |
echo "File \"$1\" is not present in the movies or tvshows folders. Deleting..." | |
rm "$1" | |
fi; | |
} | |
export -f findExistingFile | |
find $DOWNLOAD_FOLDER -type f -size +1G -exec bash -c 'findExistingFile "$0"' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works perfectly for me. I need this because of hard links.