Ignoring open files when pointing at a directory?

Is it possible to ignore open files when using the move command? I'm having an issue where rclone moves (and deletes) the file while it is still being written to.

Can you provide a debug log with -vv that shows the issue you are seeing? If a file is opened, it should say it's being modified and not move it.

rclone should ignore any file that is currently open. I've never seen this fail. An exception might be torrents but that's not so much rclone's fault but rather that some individual files in a given torrent ight be complete while others are still downloading - and removing any of the set before ti is done could easily annoy the torrent-client.

Also - some applications open and close a file repeatedly rather than keeping the file open until done. Rclone could move a file in such a gap between access - but again that's not really rclone's fault.

You could try adding --min-age 10m to tell rclone to ignore any file modified within the last 10 minutes. That may help.

But if you are sure that rclone is actually moving the file WHILE something else is accessing it then please provide debug log because that could be a serious bug. I think it is more likely one of the other scenarios I mentioned as in my experience rclone handles this smoothly, but it is worth investigating. What sort of application(s) do you believe were writing to the file at the time?

Where are you moving from and to?

If you are doing a very quick move then rclone might not notice the file is being written to.

Rclone's open detection relies on stuff being written to the file during the course of the move.

Oh, so rclone detects access by actual changes to the file? (modtime presumably? Or access-time?)
I had assumed it queried the OS or something like that.

Does that mean that rclone could potentially yoink away a file that is actively being read?
Knowing these sorts of spesific details can be highly useful, so excuse my prodding :slight_smile:

Rclone detects a file is open by noticing if the modtime of size changes.

It could yes. However on unix if you delete an open file you can still access it until you close it so it isn't as catastrophic as you might think! On Windows most programs open files in such a way that you can't delete them if they are open.

1 Like

Ah, yes, this fits with my experience. So rclone doesn't necessarily protect against this but the OS normally will. That makes it mostly a non-issue for me I think, but it is helpful to know nonetheless :slight_smile:

1 Like