Running script after torrent finishes with multiple files

Discussion of the Web Interface for Transmission, formerly known as Clutch. This applies to all version of Transmission
Post Reply
Ortix
Posts: 28
Joined: Wed Nov 18, 2009 2:03 am

Running script after torrent finishes with multiple files

Post 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!
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Running script after torrent finishes with multiple file

Post 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).
Post Reply