remove finished torrents (bash script)

Discussion of Transmission that doesn't fit in the other categories
Post Reply
cleanrock
Posts: 2
Joined: Sun Oct 23, 2011 7:30 am

remove finished torrents (bash script)

Post 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.
killemov
Posts: 573
Joined: Sat Jul 31, 2010 5:04 pm

Re: remove finished torrents (bash script)

Post 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.
cleanrock
Posts: 2
Joined: Sun Oct 23, 2011 7:30 am

Re: remove finished torrents (bash script)

Post 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
Post Reply