protecting files from deletion, and using --delete-excluded

Matt McCutchen hashproduct+rsync at
Wed Aug 30 02:11:10 GMT 2006

On 8/29/06, Christophe LYON <christophe.lyon at> wrote:
> At some point I have mirrored all of them, but now I want to be able to
> tell rsync to:
> - remove all r1.* and r2.* releases
> - skip r3.* releases (ie don't scan them, but don't delete them)
> - sync r4.* releases
> I am trying to use filters:
> + /r4*/
> P /r3*/
> + /some-other-dir/
> - /* (to remove r1*,r2* but also every thing else I don't want)

Protect filters are only relevant for destination files that do not
have counterparts on the sender.  If you protect /r3*, all the files
inside /r3.1 on the receiver will still be deleted if /r3.1 is an
empty directory on the sender.  To stop the receiver's /r3.1 from
being modified at all, you should use both a hide filter (H) and a
protect filter (P).  On the other hand, if rsync is trying to remove
the directory /r3.1 itself, that is a bug, and you should send more
information so we can investigate.


More information about the rsync mailing list