rsync exclude/include [FIDUCIA virengeprüft - ohne Gewähr, daß alle bekannten Viren und deren Varianten erkannt wurden.]

Dave Dykstra dwd at bell-labs.com
Wed Nov 14 03:00:59 EST 2001


On Tue, Nov 13, 2001 at 01:44:45AM +0100, Thomas Schweikle wrote:
> 
> Hi again!
> 
> 
> 
> 
> 
> Tomasz Ciolek <tmc at goldweb.com.au> on 13.11.2001 01:21:27
> 
> An:   Thomas Schweikle <tschweikle at fiducia.de>
> Kopie:
> Thema:    Re: rsync exclude/include [FIDUCIA virengeprüft - ohne Gewähr,
>       daß alle bekannten Viren und deren Varianten erkannt wurden.]
> 
> 
> > Try dumoping the whole file list into a text file, prefix each one with
> > minus for exclude and a + for include.
> >
> > Then run rsync like this:
> >
> > rsync -avz --exclude-from="exclude.list"
> ftp3.sourceforge.net::/netbsd/iso/ ./iso/
> >
> > have a look at the rsync man page for more information on
> > the exact syntax of the unified include/exclude stuff
> > Regards.
> 
> Done that. Result: rsync include/exclude matching is definitively wrong. If
> "... matching is done using shell filename matching ..." this file should
> work:
> 
> - /*
> + /iso/1.5.*/i386*
> 
> but doesn't. Looks like "*" is matched, but does not lead to a "true"
> matched against "/iso/1.5.1/i386cd.iso".

Here's what you neeed:

    + /iso
    + /iso/1.5.*
    + /iso/1.5.*/i386*
    - /iso/1.5.*/*
    - /iso/*
    - /*

In order to understand why you need to realize that the rsync algorithm
recurses down into each directory and applies each pattern in order and
stops when it finds a match, so if you don't explicitly include the parent
directories they get excluded by the exclude wildcard and rsync never
descends down into the directory.  Note that "/*" only excludes things at
the top level, that's why I had to explicitly exclude things at the next
two levels too.  A simplification is this:

    + /iso
    + /iso/1.5.*
    + /iso/1.5.*/i386*
    - *

because if you don't have the slash preceding the exclude "*" it applies at
all levels.


> Any way to debug this, making sure how matches are really done?

The most recent snapshots of the development version of rsync will give you
more helpful information if you use -vv, but it's not yet in any released
version.  The patch is at
    http://rsync.samba.org/cgi-bin/cvsweb/rsync/exclude.c.diff?r1=1.32&r2=1.33

- Dave Dykstra




More information about the rsync mailing list