Page 1 of 1

remove finished torrents (bash script)

Posted: Sun Oct 23, 2011 7:49 am
by cleanrock
I just made myself a script to remove finished torrents, perhaps more people find it useful.

Code: Select all

#!/bin/sh
FINISHED=`transmission-remote -l | grep "  Finished "`
IDS=`echo "$FINISHED" | awk -v ORS=',' '{print $1}'`
CMD="transmission-remote -t$IDS -r"
echo "$FINISHED"
echo "$CMD"

read -r -n1 -p  "Remove above torrents ? [Y/n]" RSP
RSP=${RSP,,}    # tolower
if [ "$RSP" == "" -o "$RSP" = "y" ]
then
    $CMD
fi
PS. I know this can also be done quite easily using the web interface.

Re: remove finished torrents (bash script)

Posted: Mon Oct 24, 2011 3:46 pm
by killemov
Hey cleanrock,

so your script lists finished torrents and asks a user if he wants them removed. It has some flaws. It is run interactively and most people run transmission-daemon with username/password protection.

Check my Unrar and cleanup script for some pointers.

Re: remove finished torrents (bash script)

Posted: Mon Oct 24, 2011 4:46 pm
by cleanrock
My script is meant to be used interactively, e.g. via ssh.
I only use it to remove the torrents, not the files as you do (--remove-and-delete).
Only flaw i see is missing -n user:pw to CMD.
I did not add user/pw because i run transmissiond safely behind my firewall so i dont have to login in when i open the web interface from my lan.
If you need authentication just add "-n USER:PW" to CMD