Avoid deleting new files with rclone sync

What is the problem you are having with rclone?

Hi, I would be nice to know if there is a method to avoid rclone to delete new files when synchronize from remote. For example, I create a new file in a my local directory, then i run rclone sync from remote to local and that file is deleted since it is not on the remote. But since it is a new file, what I'm expecting is that it is leaved there. Thanks for help.

rclone version:
rclone v1.51.0

  • os/arch: linux/amd64
  • go version: go1.13.7

storage: Google Drive

hello and welcome to the forum,

perhaps you want to a copy instead of a sync.

https://rclone.org/commands/rclone_copy/
"Copy the source to the destination. Doesn’t transfer unchanged files, testing by size and modification time or MD5SUM. Doesn’t delete files from the destination"

Nope, because if there are old files in the remote that were deleted I want rclone to delete them in the local also. Copy just does not delete anything.

perhaps this?
https://rclone.org/docs/#u-update
"This forces rclone to skip any files which exist on the destination and have a modified time that is newer than the source file."

No. That won't work for him.

f an existing destination file is older than the source file then it will be updated if the size or checksum differs from the source file.

i think i am having an off day, too make mistakes.

so what is the solution then?

You might be able to use a one of the two-way sync utilities built on rclone. Not sure. You'd have to experiment.

Trying to make sure I get the flow:

Source:
filea
fileb

Destination:
fileb
filec

Run a command from source to destination and what would the dest look like? rclone just has a source and destination and that source could be a remote or could be a local as the same goes with destination. I'm just trying to make sure I get the picture.

if with that config you run rclon sync dest source then you will got:

source:
filea
fileb

Destination:
filea
fileb

Now, this is right if the filec was previously removed from the source. The point is if not, if I have created filec directly in destination and i run rclone sync source dest, then It'll be deleted and we got the same result as i write above.

1 Like

I understand how the existing copy and sync work.

I'm asking what do you want to happen.

When you run the command what does the final outcome look like? What would happen with your command to the picture above.

What do you mean? I've just tell you what should happen. If the fine is a new created one, It should not be deleted just because it is not on the source. This is the behavior I would like to have.

1 Like

Okay sorry i have updated my previous answer, I've wrong writing files in dest and source

When you update a post, I have no idea what you changed.

I'm trying to get a picture:

starting source:
filea
fileb

starting dest:
fileb
filec

run a command
new destination:
file?
file?

What is the logic that gets to the final "new destination"
example: file? is compared to the source and if newer left alone

Okay now I'll try again. If you run rclone sync source dest you get this:

source:
filea
fileb
(obviously not modified)

dest:
filea
fileb
(becomes the same as source, the filec is deleted)

Now if i create a new file in destination, filed, and then i run the command again, the filed will be deleted. This means that from

source:
filea
fileb

dest:
filea
fileb
filed (the new created one)

and i run rclone sync source dest i got

source
filea
fileb

dest
filea
fileb
(filed is deleted)

Last, if i delete filea from source and i run the sync command, then it is (now correctly) removed from dest also.
So what i want is that file not directly eliminated from the source are kept in the destination. It is possible?

I am sorry if I keep repeating but I am not asking you to explain the sync process and what sync does.

Just make a before picture and after picture so we can ensure we're saying the same thing. You keep saying the same words but I am asking for a visual to make sure I am translating what you are saying properly.

If you can just type out:
Before
Source
files

Dest
files

After
Source
Files

Dest
Files

I think I know what you want but the picture solidifies it.

1 Like

I'm pretty sure he means this:

Before source
File1 < he modified this
File 2
File3

Before dest
File 1
File 3 < he modified this

He wants it to look like this:
File1 < this replaced
File 2 < this added
File 3 < this file not touched

1 Like

I'm pretty sure too just want to see it :slight_smile:

This is a perfect example. Ty.

So, as calisro said I want this

Before source:
filea
fileb

Before dest
filea
filec

After source
filea
fileb

After dest
filea
fileb
filec

Is it okay in this way? Because otherwise I'm sorry but I'm not understanding what are actually asking to me.

Isn't that just a copy as file 1 is copied over, file 2 is added and file 3 is not touched.

In that example, that would be a copy from source to dest with source updating the dest and not deleting anything.