Any flag to make rclone clean up tmp files if stopping a copy/move?

Which cloud storage system are you using? (eg Google Drive)

Local file system

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy /src /dst -P
N/A

Not really a bug, more of a question. When using rclone copy, and not using the --inplace flag, rclone writes .tmp files until the copy is done then renames. If you ctrl-c mid copy, the partially copied tmp files remain in the destination. Is there any flag or way to cancel a copy operation that will allow rclone to clean up/delete any temp files that are not completed? Thanks in advance.

Nope. No simple flag.

Insert your rclone copy into a script where you trap ctrl-c or/and errors and run rclone delete with some filter (e.g. --include "*.tmp") when your trap is triggered.

Example to give you an idea how to do it:

Ahh nice. Thanks!

1 Like

A flag for this would be welcome!

rclone should already be cleaning any partial files automatically on receiving a SIGINT or similar. The logic is already present for that:

The cleanup should only fail on something like a SIGKILL or similar, which doesn't give rclone any time to do it.

If you are facing any issues, please post logs.

2 Likes

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