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

Christophe LYON christophe.lyon at st.com
Wed Aug 30 08:55:29 GMT 2006


Matt McCutchen wrote:
> On 8/29/06, Christophe LYON <christophe.lyon at st.com> 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.
> 
> Matt
> 

Matt,
I forgot to mention a few things:
- I use rsync-2.6.6 but from the NEWS file I didn't notice much changes 
in this area in 2.6.8
- the command I use is:
rsync -rltgoDuvR  --delete-excluded --filter='+ /rsync-filter' 
--filter=': ./rsync-filter' --include='*' . /tmp/scratch

The rsync-filter file in the root dir is the one I described in my 
initial post; the only other rsync-filter is in /some-other-dir

If I use:
+ /r4*/
P /r3*
H /r3*
+ /some-other-dir/
- /*

I still see rsync remove all my r3* dirs in the destination:
deleting r3.2/sol/
deleting r3.2/lin/
deleting r3.2/
deleting r3.1/sol/
deleting r3.1/lin/
deleting r3.1/
deleting r3.1.2/sol/
deleting r3.1.2/lin/
deleting r3.1.2/
deleting r3.0/sol/
deleting r3.0/lin/
deleting r3.0/

Christophe.


More information about the rsync mailing list