Sync but ignore destination-only files

I am trying to figure out how to rclone sync to Google Drive without overwriting the destination-only files.
Of course, there would be a possibility to run rclone copy, however, I want the all of the source files to be changed/re-ordered/updated in the destination.

By destination-only files I mean such that are added to the "synced" folder from the GD side (e.g. if I create a Gdoc in the browser in the synced folder). This implies, it is not very convenient to extend a list of "excluded" in my sync command everytime I add something from the GD side.

Any advice appreciated!

hello and welcome to the forum,
not sure exactly what you want.
perhaps this flag will help
"Using this option will make rclone unconditionally skip all files that exist on the destination, no matter the content of these files."

Hey and thanks. However, this is not an answer to my question. I need an option for ignoring only such files that are originated at the destination but not at the source. The thing is, I don't want the GDoc files at the destination to be overwritten, while I need to continuously update the files from the source.

--update                               Skip files that are newer on the destination.

If a file is newer at the destination it'll be ignored. I think this if what you're asking for.

EDIT: this would still delete files on the dest that aren't on the source. You need to use copy if you don't want that. Fundamentally how would rclone know if a file was deleted on the source versus created only on the destination....

Hey, thanks for the reply. This would rewind me back to the beginning. rclone copy is certainly something I do not want to use as this does not observe changes of file deletions and so on on the source and only clutters up remote.

I have found an solution using a union remote....

  1. create a local remote
  2. create a union remote between the local folder and the remote folder
  3. run rclone sync union /local/folder

When you are doing this, you keep your local files, and sync the files on the remote. Fast and efficient as the checks will be done locally

1 Like

This sounds ignorant, but if this works, I would like to do it the exact opposite way, thus want to keep LOCAL folder with the CLOUD folder in sync but preserve CLOUD-only files.

The docs page about rclone union is quite insufficient for me to understand union. Could you be please more elaborate in your explanation?
Thanks a lot!

So in your use case, files are added to the local folder and you want to add it to cloud remote? But don't want to erase the files you want cloud only?

I didn't understand it well.

That's right. I have files on my local and want to add it to remote but do not want to overwrite remote-only.

Try this. Add this to your rclone.conf and make sure you are using a recent rclone beta

type = local

type = union
upstreams = disk:/disk/folder remote:cloud/folder

Now when using union rclone will think both folders are just 1 remote. Then you'll call:

rclone sync union: remote:cloud/folder --dry-run --track-renames -vv

This should work. Rclone will see that the disk folder is out of sync with the remote folder, but will also see that the cloud files already exists on destination to, so it will just check them and do nothing.

Obs: Don't forget to use --dry-run and change the folder and remote names to your setup. Let me know if it happens

@ncw I just found out some strange behavior with sync. A file in the remote cloud folder was renamed, but it still not syncing it to the local folder.

I tried with --track-renames, -c but it still thinks no change happened? After this file has been renamed to another name, I uploaded another file with the old you think it could be this?

rclone should tell you in with the DEBUG log exactly why it transfers or ignores each file. What does it say about that file?

I found the issue. The default policy for the union, makes it so that the first remote is read first before the others.

I had my local folder set up first, so it was comparing the files locally. Just putting the remote folder first, makes it behave as expected with the default policy.

1 Like

Ok so today I noticed that is still not replacing the files changed in the cloud...

Any idea why? I have to use --union-search-policy=newest to make it behave like I want, but the first found policy should do that already

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