rsync to a symlink directory

jw schultz jw at pegasys.ws
Tue Sep 24 01:25:01 EST 2002


On Mon, Sep 23, 2002 at 06:03:12PM -0700, Gwendal Stevanazzi wrote:
> 
> Here is the structure of my servers :
> 
> Source :
> 
> /home/test1/link_dir
>                 sub_dir1
>                       file1
>                       file2
>                       ...
>                 sub_dir2
>                 ...
> 
> Destination:
> 
> /home/test2/real_dir
>                 sub_dir1
>                       file1
>                       file2
>                       ...
>                 subdir2
>                       ...
> /home/test2/link_dir@ -> real_dir
> 
> 
> 
> Now I want to update file1.
> If I run the command
> rsync -aRz file1 destination:/home/test2/link_dir/sub_dir1
> from /home/test1/link_dir/sub_dir1 on source, no problem, the file is
> updated.
> 
> If I run the command
> rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/
> from /home/test1 on source, the new fs structure on destination is:
> 
> /home/test2/real_dir
>                 sub_dir1
>                       file1
>                       file2
>                       ...
>                 subdir2
>                       ...
> 
> /home/test2/link_dir
>                 sub_dir1
>                       file1
> 
> The symlink is erase and replace by a 'real' directory.
> 
> 
> Is it the expected behaviour?
> 
> How could I prevent this kind of things to happen ?

It is inferred because you haven't yet traversed the link
and since rsync doesn't see a directory it will create one.  Try
rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/./
to force the traversal of the link so it is already inside
the destination.

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list