Copy Overwrite Rules - Size Rule

Hi, is there a way to configure overwrite rules when using the copy function?
I would like to overwrite only if the destination file is smaller than the source file.

I can't seem to find this in the docs.
This is because I am doing archival work and the dates can't be relied upon and I am doing it in batches (rclone copy then delete a batch of files in source)
So there might be a file of 100MB in the 1st batch but if there is a file of 50MB in the 2nd batch, I am afraid that the already uploaded 100MB in the 1st batch will be overwritten with the smaller file.

What is your rclone version (output from rclone version)

rclone v1.56.0

  • os/version: Microsoft Windows 10 Pro 2009 (64 bit)
  • os/kernel: 10.0.19043.1237 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.16.5
  • go/linking: dynamic
  • go/tags: cmount

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

Google Drive and Shared Storage (teams)

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

rclone copy . dest: 

hello and welcome to the forum,

rclone does not have a set of rules.
not sure there is a way to finagle any set of rclone flags.
tho somebody more experienced might know more about that.

i can think of two workarounds

  • write a simple script to compare the size of each source file against the dest, if it exists and apply that rule.
  • use rclone mount and a copy tool designed for local.

What you could do is use --suffix .ID where ID is something you change for each batch.

What this will do is make a backup of any existing files with the ID - you can then search for this ID and sort out the potential duplicates after you've finished all the copies.


1 Like

Thank you for the solution :slight_smile:
I understand the idea of attaching suffix and later on, find try to correct the duplicates.

Improvement suggestion:
Since there is no mechanism to handle existing/overwrite, I still think it is a good idea to have an option to be able to set the rules; at the very least, alert the user on the console output that which file is affected and what had been done by rclone.
Being able to set a flag to prevent overwrites would also be nice since rclone is overwriting all files in the destination with no options to prevent that right now.

The way I found out about the current overwrite behaviour was when I performed my own tests. Would also be nice if it was included in the documentation.

Thank you again.

Yet another feature request to investigate within ticket

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