Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I happen to know about rsyn, and I use rsync to sync between my mac and a linux server as follows.

rsync -r -t -v MAC LINUX
rsync -r -t -v LINUX MAC

I expected to run the first command to sync, but I needed the second command also when a change is made in LINUX.

Am I missing something? Does rsync have an option to sync between two directories?

share|improve this question

5 Answers 5

up vote 8 down vote accepted

You want bi-directional sync. Take a look at unison, which does this: http://www.cis.upenn.edu/~bcpierce/unison/

share|improve this answer

You should also take a look at csync, which is open source and offers native bi-directional syncing.

FYI - as far as I know - csync is developed by people from the Samba team. And knowing that the Samba team also developed rsync, I take this as a token of quality.

share|improve this answer

I coded this small tool for my own needs:

https://github.com/dooblem/bsync

It uses rsync and can handle file moves.

share|improve this answer

Another excellent tool for bidirectional sync.....freefilesync

share|improve this answer
1  
on Stack Exchange, we prefer answers that are more than just links. it would be great if you could expand a little on what this is (what makes it different from unison?) –  strugee Nov 15 '13 at 21:15

rsync is actually not recommended for two-way sync (by it's developers). The already recommended unison will be a better solution for you.

Also keep in mind that you probably have to deal with a lot of Mac specific HFS+ stuff when using rsync. So be sure to use a properly patched rsync3 on the Mac or expect problems with modification dates (when using the Mac OS X provided rsync 2.6.9.) If you don't know how to build a properly patched rsync 3 for the Mac, get mlbackup which includes just that. (Full disclosure: I am the author of mlbackup.) Get it from github and be sure to download the full package from the downloads. (The mlbackup repo does not include rsync 3 which you want in this case.) http://github.com/MacLemon/mlbackup

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.