Now I'm moving to Linux, and I didn't find any cleanup-scripts for it, so I made one, and thought I'd share it. Nothing fancy, but quite handy.
cleanup.sh
Code: Select all
#!/bin/sh
filecount=0
nzbcount=0
sfvcount=0
nfocount=0
subcount=0
idxcount=0
srrcount=0
echo "This cleanup is intended for TV-shows."
echo ""
echo "Cleaning up download directory: $1"
echo ""
echo "Deleting .nzb-files"
nzbcount=`find $1 -type f -name "*.nzb" -exec bash -c "rm -vf '{}'" \; | wc -l`
echo "Deleting .sfv-files"
sfvcount=`find $1 -type f -name "*.sfv" -exec bash -c "rm -vf '{}'" \; | wc -l`
echo "Deleting .nfo-files"
nfocount=`find $1 -type f -name "*.nfo" -exec bash -c "rm -vf '{}'" \; | wc -l`
echo "Deleting subtitle-files"
subcount=`find $1 -type f -name "*.sub" -exec bash -c "rm -vf '{}'" \; | wc -l`
subcount=$[$subcount+`find $1 -type f -name "*.srt" -exec bash -c "rm -vf '{}'" \; | wc -l`]
echo "Deleting .idx-files"
idxcount=`find $1 -type f -name "*.idx" -exec bash -c "rm -vf '{}'" \; | wc -l`
echo "Deleting .srr-files"
srrcount=`find $1 -type f -name "*.srr" -exec bash -c "rm -vf '{}'" \; | wc -l`
let filecount=$nzbcount+$sfvcount+$nfocount+$subcount+$idxcount+$srrcount
echo ""
echo "Cleanup completed."
echo "Deleted $filecount files ($nzbcount .nzb, $sfvcount .sfv, $nfocount .nfo, $subcount subtitle-files, $idxcount .idx, $srrcount .srr)."