Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two identically named directories with similar subdirectories and I would like to merge the contents of one into the other. I'm trying to use rsync to do this and I'm finding that symlinks appear to have been created in the destination directory, but then disappear the next time I access the directory (I would like to preserve symlinks).

An example (destination dir is currently empty):

Source directory:

Destination directory:

The rsync command I'm using:

rsync -av /tmp/dir_3 /dir_1

The output of rsync seems to indicate that symlinks are being followed and if I cd into the destination directory and immediately execute the tree command it shows the symlinks and the right number of directories and files (i.e. it matches what is in the destination directory). However, the second time I run the tree command the symlinks are gone and I can confirm that with ls.

The symlinks in question are a little tricky, but are linking entirely between subdirectories within in the Source directory. A simplified example:

is a link to


is a link to

I've also tried adding the -l option to the rsync command but that doesn't seem to make a difference (and I wouldn't really expect it to as -a should copy links).

Any ideas what I'm doing incorrectly?

share|improve this question

migrated from stackoverflow.com May 30 '13 at 5:44

This question came from our site for professional and enthusiast programmers.

If the symlinks are there after rsync has completed, but gone when you look later, then clearly something other than rsync is manipulating them. Or have I misunderstood the order of events? –  IMSoP May 29 '13 at 21:44
You're correct about sequence of events. I've found that if I move the dest folder outside of the home folder the issue doesn't occur. Not sure why that is an issue as I am running rsync as that user and both the source and destination dirs and contents are owned by that user. This will work for our production installation, so I'm going to move forward with that. Would be great to understand what is going on here though.. I might come back to it. –  Axl May 29 '13 at 22:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.