Skip to content

Instantly share code, notes, and snippets.

View chrodriguez's full-sized avatar

Christian Rodriguez chrodriguez

View GitHub Profile
@chrodriguez
chrodriguez / remove-finished-torrents
Last active January 6, 2024 22:48
Transmission delete finished torrents
#!/bin/sh
TORRENTLIST=`transmission-remote --auth=user:pass --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`
for TORRENTID in $TORRENTLIST
do
echo "* * * * * Operations on torrent ID $TORRENTID starting. * * * * *"
DL_COMPLETED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "Percent Done: 100%"`
STATE_STOPPED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "State: Stopped\|Finished\|Idle"`
if [ "$DL_COMPLETED" != "" ] && [ "$STATE_STOPPED" != "" ]; then