RFE: extend --keep-dirlinks to files also

Matt McCutchen matt at mattmccutchen.net
Mon Jul 7 14:44:06 GMT 2008


On Mon, 2008-07-07 at 12:49 +0200, Hendrik Maryns wrote:
> I just read the thread 
> http://lists.samba.org/archive/rsync/2004-June/009678.html which 
> describes how --keep-dirlinks came to be.  My use case is similar, but 
> I’d like a similar option for files as well.
> 
> Setup: in my public_html I have some symlinks which I send over as 
> files, with -L (for various reasons: partly, because they are copies of 
> current work which is done elsewhere, or because several websites use 
> the same files, such as SSI footers).  However, I also want to check 
> whether my colleague changed the files on the server, so first I do an 
> update.  However, this replaces the links with the files themselves.
> 
> My current usage is:
> 
> # First look whether stuff changed on the other side (shouldn’t)
> # rsync -rtKPuzb webserver:public_html/ /home/hendrik/public_html/Hendrik/
> # Then put changes from here.
> rsync -rtkKLPzC --delete --delete-excluded 
> --exclude-from=/home/hendrik/.website-exclude 
> /home/hendrik/public_html/Hendrik/ webserver:public_html
> 
> As you can see, I have the first line commented out, because it replaces 
> symlinks.  I’d like something similar to --keep-dirlinks which follows 
> links on the receiver and compares the files linked to with those sent.
> 
> Is this possible, or is it an RFE?

If files aren't supposed to change directly on the server, it seems to
me that you could just drop the first command, add -uvv to the second
command, watch for any "FILE is newer" messages, and handle those files
manually.  If files do change, consider using the two-way synchronizer
Unison ( http://www.cis.upenn.edu/~bcpierce/unison/ ); it can update
files through symlinks, but I don't think it has an equivalent to
--delete-excluded.

A --keep-links option may still be worth having in rsync.  Updating a
file atomically through a symlink is nontrivial (one has to readlink the
chain of symlinks and combine the paths to find the ultimate location to
rename to), but Unison implements this, so I don't see why rsync
couldn't.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/rsync/attachments/20080707/4ebaf4e8/attachment.bin


More information about the rsync mailing list