#############################################
time=$(date "+%Y-%m-%d (%H:%M:%S)")
if [ -n "$tr_auth" ]; then
tr_auth="--auth=$tr_auth"
fi
for file in "$watchdir"*.torrent
do
if [ -f "$file" ]; then
if [ -n "$verbose" ]; then echo "$time: $file added to queue."; fi
/usr/local/bin/transmission-remote "$tr_host" "$tr_auth" -a "$file" > /dev/null
# give the remote some time to process
sleep 5
if [ $movesubdir ]; then
if [ -d "$watchdir$movesubdir" ]; then
mv "$file" "$watchdir$movesubdir"
else
mkdir "$watchdir$movesubdir"
mv "$file" "$watchdir$movesubdir"
fi
else
rm "$file"
fi
else
if [ -n "$verbose" ]; then echo "$time: No torrent in $watchdir."; fi
fi
done