I was under the impression from here among other research, that rsync was the command used to sync directories and any contents they have.

I have tried the following commands:

rsync -avzr ~/testing123 ~/Desktop/apartment
sudo rsync -avzr ~/testing123 ~/Desktop/apartment

Neither of them preserve the icon, they both produce the same result:

sent 544 bytes  received 92 bytes  1272.00 bytes/sec
total size is 6148  speedup is 9.67
building file list ... done
created directory /Users/null/Desktop/apartment

sent 566 bytes  received 92 bytes  1316.00 bytes/sec
total size is 6166  speedup is 9.37

They both sync the files correctly but do not preserve the icon from the original file or directory. For directories, rather than preserving the icon on a folder, both commands create a '0 KB' file in the destination directory called 'Icon' with no extension. For files, it does nothing, no mystery 'Icon' file, and no actual icon.

Is it a matter of me using the wrong arguments? What is the problem here? Why won't rsync actually create the same icons on the destination files as on the source files?

  • Please make an effort to format your post properly. – Daniel Beck Feb 3 '12 at 18:32
  • My apologies, what did I not do that I should have done (besides a misspelling in the name that I did not notice until now)? – FALL3N Feb 4 '12 at 18:51

You need to specify the -E option to rsync.

   -E, --extended-attributes
          Apple specific option  to  copy  extended  attributes,  resource
          forks,  and  ACLs.   Requires at least Mac OS X 10.4 or suitably
          patched rsync.

Icons are stored in HFS+ resource forks.

  • thanks! that was the answer! oh, this is not something I need to know in order to do this, but what actually was that file 'Icon' that was 0kb in a directory I was rsyncing? – FALL3N Feb 4 '12 at 18:49
  • You're welcome. See here for details. – Daniel Beck Feb 4 '12 at 22:21
  • 3
    Seems to me that this option is abbreviated "-X" in rsync 3.x. -E stands for "executability". – Kuba Wyrostek May 16 '13 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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