Exclude folder if it contains a certain file extension


My situation is that I want to have rclone constantly moving video files from my torrents directory into GDrive. My current command is basically this: rclone move /home/tor/downloads/ gdrive:downloads/ --include "*.{mp4,mkv}", and it works good – due to the fact that partial torrent files get a “.part” extension, rclone doesn’t touch them.

However, if I am downloading a torrent that contains several video files, and my rclone move cron runs at the same time as a torrent is only partially completed (eg: it will have a mix of both .mp4 files and .part files in the same torrent subdirectory), rclone will move away those mp4s, breaking the in-progress download.

What would fix it in rclone, is something like --exclude-if-present "*.part" – if a subdirectory contains any .part file extension, rclone should temporary ignore that entire subdirectory.

So is something like this possible that I have just missed? (Of course, the easiest quick solution in my case is to use the “incomplete-dir” functionality of the torrent client, so incomplete files aren’t in the staging area in the first place… but I’m just curious if there’s any functionality like this already in rclone). Thanks for the help and your work!

What torrent program are you using?

With ruTorrent, you can move / hard link when done which takes no disk space and you can just straight rclone move it.

I’m using Transmission, and yep, it’s possible to do similar things with it. :slight_smile: I was just was curious if rclone had the behavior I explained (which I don’t think it does), or if I’ll be needing to change my flow a bit.

You could wrap rclone with a bash script to include what you want using a --files-from parameter and the bash would check the criteria but as said above, its far more cleaner to just use the move/done instead. I personally use move/done and then have deluge fire a post command to move the torrent to cloud using a post execution plugin.

You could also tell rclone to move only files that were not modified in last hour, I had similar solution years ago before I switched to usenet.