Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read about rsync but I want to ask how can I do the following by rsync:

I have two files in to different machine (UNIX-AIX) and have the same name.

server1 : ..../file.txt
server2 : ..../file.txt

I want to apply the following in two server to make sure I have the latest version of file.txt on each server.


if (mod-time[file.txt (on server 1] > mod-time[file.txt (on server2)] )
   update file.txt (on server 2 ) to become as file.txt (on server 1) ;
  skip ;


if (mod-time[file.txt (on server2)] > mod-time[file.txt (on server1)] )
   update file.txt (on server 1 ) to become as file.txt (on server 2) ;
   skip ;    
share|improve this question
up vote 3 down vote accepted

Try Unison. It's two-way file synchronization software. Documentation.

Sooner or later you have to handle collisions (someone/something modified both files - are you going to merge changes or just overwrite older version).

Also, you might want to use (depending on your use) some version control system to synchronize changes.

share|improve this answer
overwrite older version – Mohammad AL-Rawabdeh Mar 27 '11 at 11:03
please from where i can download Unix verion please you can give me direct link ???? – Mohammad AL-Rawabdeh Mar 27 '11 at 12:09
@Mohammed: click the word "Unison" in Olli's answer. On the Unison home page click the link "downloads" in the menu on the left. – RedGrittyBrick Mar 27 '11 at 12:14
yes ... but i don't know which option i will use to UNIX ? – Mohammad AL-Rawabdeh Mar 27 '11 at 12:27
@Mohammed: well, this one: , but you have to compile it by yourself. You should refer documentation (linked on my answer). – Olli Mar 27 '11 at 17:02

Your Answer


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.