Anyway to copy only if larger?


I was wonder if it were possible to have rclone only copy and replace a existing file if it is larger than destination?


--size-only is probably what you are looking for.

From the docs:

      --size-only                            Skip based on size only, not mod-time or checksum

Always, make sure to check via --dry-run once to see if the results are what you would expect.

Thanks for the reply Darth Shadow. I was looking into this but will this not also transfer over smaller files?

For example:
Source - file.mkv = 1 gb

Dest - file.mkv = 8 gb

Will dest be overwritten using - - size-only?

Check out flag --min-size 1G, this should set it so that only files larger than 1GB will be considered by rclone.
Also use --size-only so that rclone doesnt skip the file which is newer on the dest with the same name.
This should overwrite files that have size different than the one that exists.
But remember that --min-size flag sets a global limit on the copy and not perfile.
If it fits your use case you can try this.

If its neccessory to strictly update files larger than the onle on dest,
you can use rclone lsjson to fetch the files which returns the file size as well,
using any programming language iterate over it to check which files should be transferred
and use rclone copy src dst --files-from files_to_copy.txt --size-only.

The concept of 'larger' really doesn't apply to a copy or sync command.

You can compare the source and destination on many options like:

      --ignore-case                          Ignore case in filters (case insensitive)
      --ignore-case-sync                     Ignore case when synchronizing
      --ignore-checksum                      Skip post copy check of checksums.
      --ignore-errors                        delete even if there are I/O errors
      --ignore-existing                      Skip all files that exist on destination
      --ignore-size                          Ignore size when skipping use mod-time or checksum.
  -I, --ignore-times                         Don't skip files that match size and time - transfer all files
      --size-only                            Skip based on size only, not mod-time or checksum

If your use case is only copy A to B if A > B, you'd have to script something as I'm not aware of any tool offhand that does that logic.

If your use case is A newer than B, copy works fine.

What's your workflow that makes A larger and older than B?

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