summaryrefslogtreecommitdiff
path: root/cptorrents
blob: 27bd8e16f885d61af873d392494af9337ebfa69e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh

[[ ! $# -eq 1 ]] && echo "usage: cptorrents <dir>" && exit 1

dir=${1:-~/Downloads}
files=$(find $dir -name "*.torrent")

if [ -n "$files" ]; then
    printf "selected torrents:\n$files\n\n"
    read -p "ok? [Y/n] " reply
    case $reply in
        n | N | no | NO ) exit 1;;
        *) printf "syncing\n";
           rsync -av ${files[@]} ben@dev.simatime.com:/mnt/campbell/ben/torrents/in;
           rm $dir/*.torrent;
           exit 0;
    esac
else
    echo "No torrents found."
    exit 1
fi