Last active
March 31, 2020 23:25
-
-
Save RealLukeManning/a10ebc8c19ba98e8dad638a1370feb68 to your computer and use it in GitHub Desktop.
Check for unlinked downloads
This file contains 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 | |
# A simple shell script to check if all my downloaded items have a hardlink associated with them | |
# The result will be all *.mkv items that do not have more than 1 file linked to this inode | |
# This is primarily used in Conjunction with Sonarr and Radarr for downloaded item handling | |
UNLINKED_DOWNLOADS=`find /mnt/user/Media/downloads/ -type f -links 1 -iname *.mkv` | |
[ -z "$UNLINKED_DOWNLOADS" ] && echo "All good" || echo "$UNLINKED_DOWNLOADS | |
To delete all files: | |
find /mnt/user/Media/downloads/ -type f -links 1 -iname *.mkv -exec rm -i {} \;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment