Page 1 of 1

Running script after torrent finishes with multiple files

Posted: Wed Feb 02, 2011 11:41 am
by Ortix
I have this somewhat complex system set up which uploads the file after the torrent is done downloading. (and does other stuff before and after this whole process)

The script is like:

plowup "$TORRENT_FOLDER/$TORRENT_NAME" megaupload

something like that, I forgot the exact variable names, but that's what it looks like.

My question is: what happens if the torrent includes 2 files? Is there a while-loop that goes through the folder to see how many files there are and then fire the script for each file? I would test it but then i'd have to mod all my script files since i didn't build in a test-mode (i should've...). If I test it now, shit might go awry and mess up the system :( So i'd like to know what happens :)

Thanks!

Re: Running script after torrent finishes with multiple file

Posted: Wed Feb 02, 2011 6:50 pm
by rb07
Ortix wrote:Is there a while-loop that goes through the folder to see how many files there are and then fire the script for each file?
No.

The script is run once when the torrent finishes. By "finishes" it means that all the selected files have been downloaded; if after that you change the selection and the torrent starts downloading again, then the script will be executed again when that finishes. The script is also executed if you verify local content.

Your question is strange, if your script simply does a copy, it shouldn't copy like whatever was downloaded is a single file, you do a recursive copy (i.e. cp -r $TR_TORRENT_DIR/$TR_TORRENT_NAME where TR_TORRENT_NAME could be a file name, or a directory name, with sub-directories).