[CC: lftp-dev]
On Sun, 02 Dec 2001, Glenn Maynard wrote:
> On Sun, Dec 02, 2001 at 12:24:42PM +0100, Piotr Krukowiecki wrote:
> First, let's get our terminology straight: "patterns" are shell matching
> (fnmatch, ie "*path"*); regexes are regexes (".*path.".)
Ok.
> 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
I think you're right. But it seems that multiple -i and -x regex are
ORed, so having dir structure like below, you can not send only files
named 'file'. You have to use '-i ala' which matches 'ala/otherf' too.
ANDing them won't help...
./ala
./ala/file
./ala/otherf
./bum
> > > 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.
True.
One solution is to allways match against 'full path'. So first make
list of all files/directories:
(with mirror -i ".*Makefile.*" /pub/source)
/build/Makefile
/doc/
/src/
/src/somedir/
/src/somedir/somefile
/src/Makefile
/Makefile/
/Makefile/sth
Then match regex against that paths. Matched lines:
/build/Makefile
/src/Makefile
/Makefile/
which would create 'build' and 'src' dirs too.
If you want to match only files (/Makefile/ is a dir - has '/' as the
last char) you should use '-i .*Makefile.*[^/]$'
BTW, what happens if i use 'mirror -i sth -x sth' ?
--
Piotrek
irc: #debian.pl
Mors Drosophilis melanogastribus!