17

I am using rsync(1) 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 behaviour I'm looking for with rsync?

1 Answer 1

17

No sooner had I asked the question than I discovered the answer.

In fact, rsync has the option

-K / --keep-dirlinks

which appears to be exactly what I'm looking for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .