Hi all,

I was just trying to use the -I and -X options, but,
as noticed in an other message, these do not seem to
work as expected.

Specifically, it seems not possible to exclude/include a
leaf (or middle) directory without knowing the complete path,
which breaks the concept of recursive download.

Example:

wget -m -X \*/backup ftp://ftp.server.org/pub/

should retrive all under "pub" but not the directories
called "backup".
This does not work. It does not work in any possible
form except when the complete path for "backup" is
specified _or_ at least the depth, example:

-I \*/\*/\*/backup

for a depth of 3.

Of course, this is not what is wanted, since the depth or
path might not be known in advance.

Digging into the code, I found the "utils.c" contains the
functions for the include/exclude operation, specifically
"accdir()" which calls "proclist()" which calls "fnmatch()".
Last call is done in order to get the match in case of
wildcards usage.

Problems is that "fnmatch()" is called with the flag "FNM_PATHNAME",
this one force the match of "/" (file separator, I guess) only to
itself, so there is no possibility to match a complete directory
tree with just a "*".
I guess this was done intentionally, but, as mentioned above, this
causes problems in certain usecases and is not conformant to the
documentation, which mentions only "absolute path", and something
like "/*/backup" is anyway an absolute path.

If there are no reasone for this behaviour, maybe better to change
the flag of "fnmatch()", otherwise, I guess, it would be a good idea
to duplicate/flag the -I, -X in order to accept the above mentioned
possibility.

Final note: wget under cygwin works as expected, i.e. -X \*/backup
expands "*" to the complete directory tree and not only to one
directory.

Thanks.

P.S.: I did not subscribe the mailing list, so, please, in case of
answers CC me too.

bye,

-- 

piergiorgio

Reply via email to