On 28 Oct 2000, Whit <[EMAIL PROTECTED]> wrote:
> I've been trying to find a way to state an --exclude that would copy a
> specific directory name (if it exists) but no files within that directory.
> If I go "--exclude directoryname/" I get neither directory nor files. If I
> go "--exclude directoryname/*" I get both (which seems wrong). If I go
> "--exclude directoryname**" I get neither. If I give the whole path (which
> in this case has a * in it at an intermediate point - it being a
> subdirectory which occurs under some user directories) I get both. I'm
> beginning to think the syntax just can't give me a directory if I want it
> w/out the files therein. And I suppose it's rare to want it.
So you have a directory structure like this:
/tmp/test
|-- bar
| |-- a
| | |-- a
| | |-- c
| | `-- squick.c
| |-- b
| | `-- squick.c
| `-- squick.c
`-- foo
|-- a
| |-- a
| |-- c
| `-- squick.c
|-- b
| `-- squick.c
`-- squick.c
10 directories, 6 files
And you want to copy everything but the contents of the 'a'
directory, although you want to copy the 'a' directory.
Remember that include and exclude patterns are applied in order. If
you specifically include 'a' but exclude everything starting with 'a'
you should be OK:
rsync -avv /tmp/test/ --include '*/a/' --exclude '*/a/*' /tmp/test2/
The output (using a CVS version with my exclusion explanations) is:
building file list ...
including directory foo/a because of pattern */a/
excluding file foo/a/squick.c because of pattern */a/*
excluding directory foo/a/c because of pattern */a/*
excluding directory foo/a/a because of pattern */a/*
including directory bar/a because of pattern */a/
excluding file bar/a/squick.c because of pattern */a/*
excluding directory bar/a/c because of pattern */a/*
excluding directory bar/a/a because of pattern */a/*
done
./
bar/
bar/a/
bar/b/
bar/b/squick.c
bar/squick.c
foo/
foo/a/
foo/b/
foo/b/squick.c
foo/squick.c
total: matches=0 tag_hits=0 false_alarms=0 data=116
./
bar/
wrote 486 bytes read 84 bytes 1140.00 bytes/sec
total size is 116 speedup is 0.20
--
Martin Pool, Linuxcare, Inc.
+61 2 6262 8990
[EMAIL PROTECTED], http://www.linuxcare.com/
Linuxcare. Support for the revolution.
PGP signature