Preserving aliases over OSX ssh rsync

2019-05-11 00:12发布

问题:

I'm having a devil of a time preserving aliases with rsync over ssh on OSX (Yosemite)

rsync -av -e ssh me@N.N.N.N:/Users/me/stuff/ /Users/me/stuff

does not preserve aliases. It makes an alias on the destination... but it doesn't point to the original file (on the destination). Firing up a Finder window, turning on File Sharing on the source, and drag and dropping preserves aliases, but that's the only way I've figured out how to do this so far, and I would prefer a non-GUI solution. Would something besides rsync work over ssh?

I've tried both native OSX rsync as well as Homebrew's.

Thanks super in advance!

回答1:

Use the -E option. Alias files include resource forks. The -E option is documented as:

  -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.