0

这个 shell 脚本应该将文件夹中的所有内容添加到传输中。使用一个文件夹可以正常工作,但是当我同时添加多个文件夹时,它会忽略第二个文件夹。

while true; 
do
file=$(inotifywait -e moved_to --format %f /srv/watchfolderfilme)
file="/srv/watchfolderfilme/$file" 
   transmission-create -o $file.torrent -s 16384 -t http://0.0.0.0:6969/announce $file
   mv $file /srv/downloads
   chmod 0777 $file.torrent
   cp $file.torrent /srv/newtorrentfiles
   mv $file.torrent /srv/watchfoldertorrents  
done
4

1 回答 1

0

重新整理我的解决方案,找到了一个更好的解决方案,可以很好地进行多次添加

inotifywait -m /srv/watchfolderfilme -e create -e moved_to |
    while read path action file; do
#  echo "The file '$file' appeared in directory '$path' via '$action'"
   chmod 0777 $path$file
   transmission-create -o /srv/newtorrentfiles/$file.torrent -s 16384 -t http://0.0.0.0:6969/announce $path$file
   mv $path$file /srv/downloads
   chmod 0777 /srv/newtorrentfiles/$file.torrent
   cp /srv/newtorrentfiles/$file.torrent /srv/watchfoldertorrents
done
于 2014-10-29T10:06:06.570 回答