On Sun, Dec 02, 2001 at 12:24:42PM +0100, Piotr Krukowiecki wrote:
> > Not quite. -i and -x options apply not only to files, but also to directories.
>
> Patterns are applied only to directory and file name, not to all path?
> ie., I can't do 'mirror -i somedir/somefile DIR' ?
First, let's get our terminology straight: "patterns" are shell matching
(fnmatch, ie "*path"*); regexes are regexes (".*path.".)
You can do that, but it'll match the directory names against that and
probably never hit it (see below).
> Can it be done that way, some option for mirror for example? It would be
> much more usefull. With 'mirror DIR' path matched against would be
> '/file', '/dir/file' etc.
>
> If someone would like to match against only last part of path (like it's
> done now) he/she could use sth like '-i .*/PATTERN' (assuming that first
> char in path is allways '/')
I'm not sure exactly what is matched. Experimenting with it a bit, I
think it only matches underneith the path; that is, "mirror path/"
mirroring a directory with "path/file1", "path/dir" and "path/dir/file2",
the regex is matched against "file1", "dir" and "dir/file2". This is
probably fine, but some examples would help, so people don't try stuff
like
mirror -i "src/.*\.cc" src/
which won't match anything (if I'm interpreting it correctly). Some
debug output at a very high level from FileSet showing pattern matching
and results would be useful.
> > I think this should be changed so that directories are excluded/included
> > separately.
>
> This can be done if each directory ends with '/'. If we want to match
> only directories, just use 'DIRECTORY_PATTERN/$'
This looks good in theory, but consider
mirror -i ".*Makefile.*" /pub/app
It'll try to match the files in /pub/source/ against Makefile. So it'll
match the subdirectory "src" (where the Makefile resides). It doesn't match,
so it doesn't traverse the tree--and never even sees the Makefile to match it.
--
Glenn Maynard