An alternative behavior for symlink

Voelker, Bernhard bernhard.voelker at siemens-enterprise.com
Wed Apr 4 05:17:19 MDT 2012


Greg Deback (rsync) wrote:

> Hello All,
> 
> I've been googling a lot but I can't find any suitable solution or
> advice, so I'm asking you.
> I'm trying do find a way to sync two distant folders containing
> symlinks pointing to files outside the synced folders BUT with
> different target names.
> 
> Here is an example:
> ./dir1: (source)
>  file --> ../data/file
> ./dir2: (destination)
>  file --> ../share/other_file
> 
> The goal would be to update 'share/other_file' with the contents of
> 'data/file', without modifying the existing 'dir2/file' symlink. I
> couldn't find any combination of option (--copy-unsafe-links, -l, -L,
> etc.): either 'dir2/file' symlink is deleted and replaced with a real
> file, or 'dir2/file' is replaced by a symlink pointing to
> '../data/file'... that doesn't exist in destination tree.
> 
> I would really appreciate if anyone had any idea to solve this case.

There's no way. If you want to sync the content of ../data/file to
../share/other_file, then you have to do this explicitly.

rsync -aHxi ${source}/../data/file ${destination}/../share/other_file

Have a nice day,
Berny


More information about the rsync mailing list