On Wed, Apr 04, 2001 at 08:50:12PM -0700, Harry Putnam wrote:
>
> Once again I find myself in the throws of a major pain in the butt
> figuring out how to exclude the files under directories or at least
> the directories and the files.
>
> Apparently I don't use rsync in enough different circumstance for this
> to become routine.
>
> Every single time I want to use rsync for anytning more complex than
> the simplest on disk transfers. I land smack dab in a large hair
> pulling session about exclude rules.
>
> Currently trying to download the debian distro for my architecture.
>
> The setup under directory `woody/main/' looks like:
>
> drwxrwxr-x 4096 2000/12/18 09:40:43 .
> drwxrwxr-x 4096 2000/01/16 04:17:17 binary-all
> drwxrwxr-x 4096 2001/04/04 12:20:08 binary-alpha
> drwxrwxr-x 4096 2001/04/04 12:20:53 binary-arm
> drwxrwxr-x 4096 2001/04/04 12:22:42 binary-i386
> drwxrwxr-x 4096 2001/04/04 12:24:09 binary-m68k
> drwxrwxr-x 4096 2001/04/04 12:25:32 binary-powerpc
> drwxrwxr-x 4096 2001/04/04 12:26:46 binary-sparc
> drwxrwxr-x 4096 2000/01/16 04:28:31 disks-alpha
> drwxrwxr-x 4096 2000/02/07 05:19:17 disks-i386
> drwxrwxr-x 4096 2000/03/10 12:03:13 disks-m68k
> drwxrwxr-x 4096 2000/03/10 12:03:44 disks-powerpc
> drwxrwxr-x 4096 2000/01/16 04:20:23 disks-sparc
> drwxrwxr-x 4096 2001/04/04 12:27:41 source
>
> I want only binary-all/ binary-i386/ and disks-i386
>
> My command line looks like:
> rsync -navvz --exclude-from=rsync_woody_exclude
>rsync://ftp.debian.org/debian/dists/woody/ .
>
> I'm trying for a dryrun to see how my exclude rules work
>
> cat rsync_woody_exclude
> binary-alpha/*
> binary-arm/*
> binary-m68k/*
> binary-powerpc/*
> binary-spark/*
> disks-alpha/*
> disks-m68k/*
> disks-powerpc/*
> disks-sparc/*
> source/*
>
> But still every damn file on the server turns up in the output,
> including every thing under the ones supposedly excluded.
>
> Also trying with a leading forward slash -- same results.
>
> The man page says, well .... point blank really, that this will work.
>
> o if the pattern ends with a / then it will only
> match a directory, not a file, link or device.
>
> o if the pattern contains a wildcard character from
> the set *?[ then expression matching is applied
> using the shell filename matching rules. Otherwise
> a simple string match is used.
>
> What make this such a gripe is that every single time, a new setup has
> to be jerked with.
>
> That -n flag should allow me to find out what is going to happen.
> This is not a place where you want to have it wrong. It would involve
> thousands of files.
Unfortunately you've run into a long known bug. Here's a message I posted
4 months ago today for somebody who wanted to exclude any path ending in
"foo/*.c":
On Tue, Dec 05, 2000 at 12:09:45PM -0600, Dave Dykstra wrote:
...
> You understand correctly, this is a known bug. See
>
> http://lists.samba.org/pipermail/rsync/1999-October/001440.html
>
> There's not an easy solution, however, because the function rsync uses to
> do wildcard matches, fnmatch(), cannot completely implement the semantics
> as described in the rsync man page. A workaround for you may be to exclude
> "**/foo/*.c", but that's not complete because the semantics of "**" is such
> that including it anywhere in a pattern means that all asterisks can cross
> slash boundaries. Thus, it will match baz/foo/oof/bar.c. As I said back
> then, the rsync include/exclude semantics & implementation needs to be
> completely redone.
In the meantime the man page should probably be changed, but it's bound to
be very difficult to explain. Anybody interested in taking a crack at it?
- Dave Dykstra