Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

This has been tearing my hair out.

I need to:

  1. compare server1:/data/archive/ to server2:/data/archive/ (through rsync, ssh, etc)
  2. filenames that don't match, get copied (scp) to server2:/data/

server1 and server2 have ssh, scp, rsync access between eachother.

share|improve this question
Could you clarify what you mean by "filenames that don't match"? do you mean any files that aren't in both? could you provide an example? – roadmr Jan 20 '12 at 3:14

Assuming user "username" has ssh access to server2 from server1 you can sync changes made on server1 to server2 by running this on server1:

rsync -nav /path/to/files/ username@server2:/path/to/files/

The trailing slashes are significant, see man rsync for details.

The options used in this example are: n = dry-run, just report what will be done without actually doing it a = archive mode, preserves ownership details, links etc v = be verbose

Once you are happy it is doing what you want, you can remove the n flag.

See man rsync for more options, like --exclude and --delete, -z for compression may be useful too.

share|improve this answer

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.