cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: listing ftp directory with patterns

From: Rolf Jakob <rolf.jakob_at_panalpina.com>
Date: Wed, 26 Nov 2003 14:06:30 +0100

On Tuesday 25 November 2003 18:10, Daniel Stenberg wrote:
> On Tue, 25 Nov 2003, Rolf Jakob wrote:
> > I would like to use a URL like : ftp://user@host/directory/subdir/*.csv
> > to get the listing of the /directory/subdir/ with all files matching the
> > *.csv pattern. curl lists the whole subdir ignoring the pattern.
>
> Right, that is not a URL curl will do anything with.
>
> > Is there any way to get this without patching curl ?
>
> Actually there is, but I'm not sure you like it:

I like it very much because it works :-)

> Set CURLOPT_CUSTOMREQUEST to 'LIST *.csv' and use the URL as
> "ftp://user@host/directory/subdir/".
>
> This will of course give you the server's idea of what a server listing
> should look like. That is entirely server-specific (even though many look
> similar).

What I did now is I replaced LIST with NLST and append the pattern.
It's even possible to specify a URL like ftp://user@host/
and a NLST /directory/subdir/*.csv to get a listing of filenames with the
path.

With that possibility I can replace the current functions with curl calls and
I'm more than happy with that.

Many thanks,
Rolf

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-26