How rclone understands files to be deleted in the target

Hello everyone,

I was trying to implement the sync feature for my project, we all know that sync deletes the files which belongs to remote, but does not belong to source. First thing came to my mind is that, I can get a slice of full remote objects, then compare each source object (which comes from channel) with the slice and eliminate the ones which belongs to source. Then what is left in the slice are the objects to be deleted.

But this approach can take much memory and it will be slow, I care about concurrency and program to be fast. I was trying to review rclone code in github but I am not sure how rclone detects files to be deleted.

English is not my main language. Sorry for the any misunderstanding. If you can help me, I would appreciate it very much.

Thank you.

Hi Hasan,

Welcome to the forum.

There is no quick and simple answer to your questions, but they are all to some some extent answered in the usage documentation.

Here are direct links to the sections, that helped me understand the inner workings of rclone:

rclone sync



After reading them I did some real-life experiments with --dry-run.

Thanks for the reply, but I am afraid this does not answer my question. I am just curious how rsync detects files to be deleted.

  1. Does rsync stores source entires and target entires in a slice and compare them
  2. Does rsync uses channels when comparing source and remote objects

I just want to find a way to safely implement sync command to my application.

Sorry, but I do find answers for your questions in the documentation - especially after doing a few experiments.

If docs and experiments doesn’t help you, then I am afraid I cannot help you further.

Thanks for the suggestion. I checked source code a little bit more and I think I got the basic understanding for my question.

Thanks for the replies.

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