Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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

 
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.