Update only the existing files on a remote side?

We know that one can upload only files present on the local side to the remote side by flag --ignore-existing. On the other hand, flag --update does not overwrite files on the remote, which are newer than on the local side and uploads the files that are only present locally.
But how we upload only those local files to the remote side, which exist on both servers, but which are newer on the local side? In other words, I would like to update only the existing files on the remote side, but not to upload the completely new, non-existing files to the remote.

welcome to the forum,

this code will copy files that

  1. already exist in dest
    and
  2. the equivalent file in source has changed, either by date or size.
rclone lsf --files-only -R $dest > dest.txt
rclone copyto $source/$n $dest/$n -v --include-from=dest.txt
2 Likes

Thanks, that combination does it! I added just the flag --update and everything works fine now.

good,

for me, that was my first linux script.
i am windows user and use WSL to write that script.

Or the new way.

rclone lsf --files-only -R $dest | rclone copyto $source/$n $dest/$n -v --include-from=-

Does that work on windows though? :thinking:

Note: this is in the beta.

1 Like

i will do some testing and let you know

1 Like

yes, it works

rclone lsf --files-only -R %dest% | rclone copyto %source% %dest% -v --include-from=-
2020/04/03 18:34:04 INFO : There was nothing to transfer
2020/04/03 18:34:04 INFO :
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks: 4 / 4, 100%
Elapsed time: 0.0s

what is the purpose of the $n in linux code, as no need for that on windows?
as it does not seem to be needed for linux either?

./rclone lsf --files-only -R $dest | ./rclone copyto $source $dest -v --include-from=-
2020/04/03 18:35:23 INFO : There was nothing to transfer
2020/04/03 18:35:23 INFO :
Transferred: 0 / 0 Bytes, -, 0 Bytes/s, ETA -
Checks: 4 / 4, 100%
Elapsed time: 1.0s

Just a subdirectory...

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