For some reason transmission's
watch-dir functionality doesn't work for me (I tried a few "solutions" I found but nothing worked). So I made myself a script to supply for that (note that I put this script in my
crontab to run hourly, so I needed to add fullpaths for everything):
#!/bin/bash prefix='/home/user' folder=$prefix'/path/to/watched/dir' cd $folder count=$(ls -1 *.torrent 2>/dev/null | wc -l) if [ $count != 0 ];then echo $count torrents files found for torrent in '*.torrent'; do echo adding $torrent transmission-remote -n 'transmission:transmission' -a $folder/"$torrent" rm $folder/$torrent done else echo no torrents found fi
What I got with this script is that it works if there is only 1 torrent file. But if there is 2 or more, then only 1 of them is added, all of them are removed and the line
echo adding $torrent shows all torrents.
What am I doing wrong?