What's the good command to upload my file to remote right after the file finished downloading

I have some scripts downloading videos from live streaming websites. Those scripts download live streams constantly, and at some point, either the file has reached it's maximum recording length, or the streamer has finished streaming, the file will be completed.

I want to move those complete files to remote once they are finished, and leaving nothing in the folder once they have been moved. I'm not sure if I can use rclone move constantly with cron to move all files in a folder to remote without having to write more lines to check if the files has been completed. If not, what's the good command I can use?

Hopefully the same command can be used to files downloaded by torrent.


Only software aware of files' status (finished or not) is your download script or torrent software. So make them move finished files to some other local location where rclone can pick them up. For example every torrent client I know has option to move finished files to specific location.

Thanks for the suggestion.
Just curious, any way rclone can detect the file is being used or being editing before moving?

rclone simply asks your OS to a read file - if your OS allows it then rclone does its job. If your other software/OS locks a file than rclone will fail. It does not have any special ability to detect if file is used by other software or not.

Only reliable way to achieve what you are asking for is to make sure that rclone access already "finished" files. Let's say you are downloading torrent. It might be slow and nothing is happening for 1h. Only your torrent program knows that it is not finished yet. There is no way for other software to know it.

so the script has no way of knowning when a file is completed?

one option with torrents, is explained in my howto guide.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.