Is rsync really bidirectional or more unidirectional?

bretonics

So I understand that rsync works by using a checksum algorithm that updates files according to file size and date. But isn't this synchronization dependent on how source and destination are called? Doesn't the order of source to destination change the behavior of what gets synced?

Let me get to where I am going..

Obviously this input1

rsync -e ssh -varz ~/local/directory/ [email protected]:~/remoteFolder/

is not the same as input2

rsync -e ssh -varz [email protected]:~/remoteFolder/ ~/local/directory/

But I thought that either way you called rsync, the whole point of it was so that any file that is newer is updated between the local and remote destinations.

However, it seems that it's dependent on whether your new file is located under the source rather than the destination location. If I updated file1 on my local machine (same, but older file1 on server), saved it, and then used code2 to sync between locations, I noticed that the new version of file1 on my local machine does not upload to the server. It actually overwrote the updated file with the older version. If I use input2 it does upload modified to server.

Is there a way to run rsync in which it literally synchronizes new and modified files no matter whether source or destination locations are called first according to newer/modified file location?

David Z

No, rsync only ever syncs files in one direction. Think of it as a smart and more capable version of cp (or mv if you use the --remove-source-files option): smart in the sense that it tries to skip data which already exists at the destination, and capable in the sense that it can do a few things cp doesn't, such as removing files at the destination which have been deleted at the source. But at its core, it really just does the same thing, copying from a source to a destination.

As Patrick mentioned in a comment, unison will do what you're looking for, updating in both directions. It's not a standard tool, though - many UNIX-like systems will have rsync installed, but usually not unison. But on a Linux distribution you can probably find it in your package manager.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Bidirectional Vagrant Rsync

From Dev

change verilog 16x4 unidirectional mux to bidirectional mux

From Dev

MVC vs. Flux ? Bidirectional vs. Unidirectional?

From Dev

Is there a more efficient implementation for a bidirectional map?

From Dev

cp or rsync, is cp really worth it?

From Dev

Executable file isn't "really there" after rsync

From Dev

Defining many-to-many bidirectional relations more eloquently

From Dev

Is XML really more semantic that HTML with classes/ids?

From Dev

SQL query optimization - really nothing more to improve?

From Dev

create a really long string more efficiently than this

From Dev

Regex engine optimization: Is `(?:.)*` really more costly than `.*`?

From Dev

Are On-Screen Keyboards Really More Secure?

From Dev

Are QR Codes Really More Easily Read by Computers

From Dev

Is Ubuntu really more secure than Windows?

From Dev

Is BoundStatement really more efficient than SimpleStatement in Cassandra?

From Dev

What really is the best way to have MORE THAN ONE controller in a container?

From Dev

Windows service priority change really allocate more CPU utilization for that service?

From Dev

Why is windows showing more storage being taken than it really is?

From Dev

read.csv resulted in more rows than really is there

From Dev

Which is more efficient: rsync over ssh or rsync to a drive mounted locally via ssh tunnel

From Dev

What is more efficient / faster, rsync compression or ssh compression?

From Dev

Is it more efficient to rsync uncompressed text data or the same data gzipped?

From Dev

Mapping a JPA bidirectional @ManyToOne relationship to more than one table using join tables

From Dev

Variables more local than the rest of local variables ( is it really "more local" or just "isolated" from the rest that are "as local as" it's?)

From Dev

Unidirectional data flow in React

From Dev

Join in unidirectional association

From Dev

Vagrant unidirectional synced folder

From Dev

JPA OneToOne unidirectional mapping

From Dev

JPA cross unidirectional OneToOne

Related Related

  1. 1

    Bidirectional Vagrant Rsync

  2. 2

    change verilog 16x4 unidirectional mux to bidirectional mux

  3. 3

    MVC vs. Flux ? Bidirectional vs. Unidirectional?

  4. 4

    Is there a more efficient implementation for a bidirectional map?

  5. 5

    cp or rsync, is cp really worth it?

  6. 6

    Executable file isn't "really there" after rsync

  7. 7

    Defining many-to-many bidirectional relations more eloquently

  8. 8

    Is XML really more semantic that HTML with classes/ids?

  9. 9

    SQL query optimization - really nothing more to improve?

  10. 10

    create a really long string more efficiently than this

  11. 11

    Regex engine optimization: Is `(?:.)*` really more costly than `.*`?

  12. 12

    Are On-Screen Keyboards Really More Secure?

  13. 13

    Are QR Codes Really More Easily Read by Computers

  14. 14

    Is Ubuntu really more secure than Windows?

  15. 15

    Is BoundStatement really more efficient than SimpleStatement in Cassandra?

  16. 16

    What really is the best way to have MORE THAN ONE controller in a container?

  17. 17

    Windows service priority change really allocate more CPU utilization for that service?

  18. 18

    Why is windows showing more storage being taken than it really is?

  19. 19

    read.csv resulted in more rows than really is there

  20. 20

    Which is more efficient: rsync over ssh or rsync to a drive mounted locally via ssh tunnel

  21. 21

    What is more efficient / faster, rsync compression or ssh compression?

  22. 22

    Is it more efficient to rsync uncompressed text data or the same data gzipped?

  23. 23

    Mapping a JPA bidirectional @ManyToOne relationship to more than one table using join tables

  24. 24

    Variables more local than the rest of local variables ( is it really "more local" or just "isolated" from the rest that are "as local as" it's?)

  25. 25

    Unidirectional data flow in React

  26. 26

    Join in unidirectional association

  27. 27

    Vagrant unidirectional synced folder

  28. 28

    JPA OneToOne unidirectional mapping

  29. 29

    JPA cross unidirectional OneToOne

HotTag

Archive