rsync deleting symbolic link unexpectedly

Eric Horne eric.horne at
Tue Dec 20 19:40:22 GMT 2005

I'm running 2.6.6 on a red hat EL3 system.

using the following command,

rsync -rlptDvzL --stats --include=a/ --include=a/dir/ 
--include=a/dir/symlink/ --include=a/dir/symlink/dir2/ 
--include=a/dir/symlink/dir2/dir3/ --exclude='**' /export/stuff 

I expect the "symlink" (which is really a symbolic link to a directory) 
to be preserved on the remote site even if dir2/dir3 doesn't exist. Yet, 
when this transfer is executed under those conditions, the remote site's 
symlink is removed and replaced with a directory of the same name as the 
symbolic link (literally "symlink" in this case). The command above is 
automatically generated. The idea is to copy ONLY the directory 
structure, creating any missing pieces of the structure on the remote 
system, but none of the files.

Some details:

on the local system, I have /export/stuff/a/dir/symlink which is a 
symbolic link to "dir1", which of course exists and contains dir2/dir3.
local: /export/stuff/a/dir/symlink -> dir1

on the remote system, I have /export/stuff/a/dir/symlink where symlink 
is a link to "dir1" containing only the directory dir2 (not dir2/dir3). 
in other words, dir3 doesn't exist on the remote system.
remote: /export/stuff/a/dir/symlink -> dir1

When I run the command I mentioned earlier, on the remote system I get 
"symlink" as a real directory that contains a fully populated dir2/dir3 
directory. The symbolic link that was there is now gone.

note that I'm only trying to copy the directory structure, not any files 
contained within.

What am I doing wrong?

Thanks for the help.


More information about the rsync mailing list