Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 am using rsync to synchronize files between a source area and a target area, where the target directory hierarchy contains symbolic links.

When a source directory has the same name and relative path as a symbolic link in the target area, then rsync replaces the symbolic link with the copied source directory and all its contents. I want rsync to instead leave the symbolic link intact, and only copy files that would have been copied had the symbolic link been a real directory.

I'm currently using -Cvrtp options to rsync. I'm aware of the --links option, but that appears to relate only to symbolic links in the source area.

Is there a way to obtain the behavour I'm looking for with rsync?

share|improve this question

No sooner had I asked the question, then I discovered the answer:

The -K / --keep-dirlinks rsync option would appear to be exactly what I'm looking for.

share|improve this answer

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.