Symlink file syncing issue

Wayne Davison wayned at samba.org
Mon Nov 8 17:03:14 GMT 2004


On Sun, Nov 07, 2004 at 01:51:40PM -0800, Joel Watson wrote:
> [The -L] works as expected for the folders (the symlinks remain intact
> at ~/Sync on the local machine and the linked locations are updated)

That is not what -L does.  It was an unintended side-effect on older
rsync versions that -L affected operations on the receiving side, but
its only purpose is to transform symlinks on the sending side into the
referent files/dirs.  In 2.6.3, the unintended side-effect on the
receiving side went away and got its own option:  --keep-dirlinks (-K).

There has never been an rsync option to update local files in the spot
where a symlink points.  You probably thought it worked only because the
unintentional -L side-effect could deceive you if the files were
identical:  no update occurs when they are the same, but when they
differed, the symlink was replaced with the real file from the sender.

In 2.6.3 this was fixed so that a local symlink is always replaced if
the remote name is a file (or points to a file w/-L) rather than a
symlink.  The -K option can also be used to allow redirected directories
on the local system.

As long as the symlinks dir has matching symlinks (i.e. the referent
files aren't in different places on each machine), you can use the
--files-from option to update both the directories and the files without
the symlink directory:

cat <<EOT
Library/Application Support/AddressBook
Library/Application Support/Adium 2.0
Library/Safari/Bookmarks.plist
Library/Calendars
Library/StickiesDatabase
EOT >file-list

rsync -av --files-from=file-list remote:/Users/username /Users/username

You can even use a file-list on the remote machine:

rsync -av --files-from=:/path/file-list file-list remote:/Users/username /Users/username

(The leading ':' is a shorthand for a matching "remote:" prefix for the
files-from file.)

..wayne..


More information about the rsync mailing list