-
-
Save sasajib/026fa94e2e010ec2fe4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DEST_DIR="/some/other/dir" | |
function linker() { # create simlink to downloaded files, rather than copy to final directory | |
if [ ! -d "$DEST_DIR/$1" ]; then mkdir "$DEST_DIR/$1"; fi | |
cd "$1" | |
for F in *; do | |
if [ -d "$F" ]; then linker "$1/$F"; fi | |
ln -s "$TR_TORRENT_DIR/$1/$F" "$DEST_DIR/$1" | |
done | |
} | |
cd $TR_TORRENT_DIR | |
if [ -d "$TR_TORRENT_NAME" ] | |
then | |
if ls "$TR_TORRENT_NAME"/*.rar > /dev/null 2>&1 | |
then | |
find "$TR_TORRENT_NAME" -iname "*.rar" | while read file | |
do | |
unrar x -inul "$file" | |
done | |
transmission-remote -n name:password -t$TR_TORRENT_ID --remove-and-delete & | |
echo "Unrarred $TR_TORRENT_NAME" >> /var/log/posttorrent.log | |
else # for multifile torrents that aren't rar'd | |
# cp -r "$TR_TORRENT_NAME" "$DEST_DIR" | |
linker "$TR_TORRENT_NAME" | |
fi | |
else # for single file torrents | |
# cp "$TR_TORRENT_NAME" "$DEST_DIR" | |
ln -s "$TR_TORRENT_NAME" "$DEST_DIR" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment