Super User is a question and answer site for computer enthusiasts and power users. 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 would like to synchronise the contents of two directories.

  • Without overwriting but to create a copy if two files have the same name, but different sizes
  • Without duplicating if two files have the same name and size.
  • To work recursively

So far I have found the following command which might work

 $ rsync -varE --progress ~/folder /volumes/server/folder

But I'm not entirely sure what the -E flag does. It was suggested by a user on but couldn't see a description for it in the manual. Would this do what I require successfully?

share|improve this question
From the manual page of rsync: -E, --executability preserve executability – Oliver Salzburg Feb 2 '12 at 14:15
There's an interesting approach to use rsync to build similar functionality to Apples Time Machine. I have never used it, but maybe this is for you: – Oliver Salzburg Feb 2 '12 at 14:17
Can you be specific as to why these rules are so. e.g. by 'having the same name and size' do you consider this as a test of whether the files are the same? And by 'same name but different size' does this refer to files that have changed? – Chris2048 Apr 9 '12 at 13:10
Same name, same size = files are identical; same name but different size = files have changed. Sometimes copying a folder without overwriting will create duplicates of identical files which I won't want. Note, I'm doing this on a mac. – Adam-E Apr 11 '12 at 10:49
up vote 2 down vote accepted

-E actually preserves extended attributes on OS X, but -a (--archive) implies -p (--perms) which implies --executability.

-b (--backup) adds a tilde to the end of files that would normally get overwritten:

rsync -ab ~/folder /Volumes/server/

-b --suffix _old would rename file.txt to file.txt_old

rsync compares both file sizes and modification times by default. --size-only only compares sizes. -c compares checksums, but it's slower.

share|improve this answer
Perfect. I just ran a test on this and is exactly what I was after. Many thanks. – Adam-E Mar 28 '13 at 9:52
@LauriRatna sorry forgot to ask, will this command skip the copying of identical files, thereby speeding up the process? – Adam-E Mar 28 '13 at 20:30
Yeah. You can add -v to see what files it copies. – user495470 Mar 28 '13 at 20:34

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.