--delete, but not for symlinks?

Matt McCutchen hashproduct+rsync at gmail.com
Wed Sep 13 23:41:39 GMT 2006

On 9/13/06, Charles Sprickman <spork at bway.net> wrote:
> Is there any way to make use of the --delete flag when doing the transfer
> and NOT have those symlinks that only exist on the new box be blown away?

If you can write a glob that matches the paths of these symlinks and
nothing else, you can pass it to rsync as a protect filter.  The
receiving rsync (running on the new box) will not delete files located
at paths that match the glob.  For example:
    rsync --filter='P /home/[a-z]/*' <more arguments>

This is a better approach than not deleting any symlinks at all,
because you may delete a symlink in some unrelated area of the old box
and want that deletion to propagate to the new box.


More information about the rsync mailing list