Force rsync to copy symlink, even if referent does not exist

I am getting this message with rsync:

symlink has no referent: "/a/path"

Well, rsync is right: in the source filesystem, the (symbolic) link is pointing to a non-existent location. That is intended. The target of the link only exists in the destination filesystem. And I want rsync to ignore that fact and create the symlink in the destination.

How can I force rsync to do that?


Solution 1:

Use -a option with rsync.

It will copy the broken symlinks too.

Something like this:

 # rsync -av source host:destination