Skip to content

Instantly share code, notes, and snippets.

@jaikumarm
Last active March 12, 2018 03:54
Show Gist options
  • Save jaikumarm/ca6e346196494a580d7fa28ebe081efc to your computer and use it in GitHub Desktop.
Save jaikumarm/ca6e346196494a580d7fa28ebe081efc to your computer and use it in GitHub Desktop.
post download auto unrar script for transmission
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/path/to/transmission_unrar.sh",
#!/bin/bash
echo "Checking $TR_TORRENT_DIR/" >> ~/Downloads/unrar_torrent.log
echo "Checking $TR_TORRENT_NAME" >> ~/Downloads/unrar_torrent.log
cd $TR_TORRENT_DIR
# if torrent has directory
if [ -d "$TR_TORRENT_NAME" ]
then
# check if directory has rar files
if ls "$TR_TORRENT_NAME"/*.rar > /dev/null 2>&1
then
# find rar file
find "$TR_TORRENT_NAME" -iname "*.rar" | while read file
do
# unrar the file to same location
#echo "$file" >> ~/Downloads/unrar_torrent.log
/usr/local/bin/unrar x "$file" "$TR_TORRENT_NAME"
echo "Unrarred $TR_TORRENT_DIR/$file" >> ~/Downloads/unrar_torrent.log
done
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment