curl-library
Re: FTP directory processing
Date: Thu, 9 Jan 2003 10:01:56 +0100 (MET)
On Wed, 8 Jan 2003, Henke, Markus wrote:
> - Is it possible to receive a somehow canonical or
> standardised directory listing?
No. LIST shows a listing that the server can show anyway it wants. NLST shows
a listing that on some servers don't include all directory entries.
> - If not, it seems that even ftp daemons on the
> same platform produce different listings!?
Yes, that is correct. FTP client authors have to sweat a lot to write parsers
that understand the plethora of formats.
> - I know how to send FTP-commands (like SYST)
> using "CURLOPT_QUOTE" and to receive the server response using
> "CURLOPT_WRITEHEADER". But to send the command, i've to make a (virtually
> unnecessary) "curl_easy_perform" (unnecessary since i don't want anything
> else except the server response, e.g. "215 Windows_NT version 5.0").
> I'm missing something or is the "curl_easy_perform" defacto
> indispensable?
You can't perform any operation with the easy interface without it, no.
> More precise: Is there a way to do something similar to "CURLOPT_QUOTE"
> w/o a "curl_easy_perform"?
Nope. While this may sound strange to some people, remember that libcurl is a
file transfer library, it is not a generic nor a complete FTP library.
> - By now i'm using CURLOPT_NOBODY to suppress
> the result of the above mentioned "curl_easy_perform",
> but i guess the response (e.g. a directory listing) is
> send over the network and only suppresssed in
> libcurl!?
No. If you specify NOBODY, libcurl won't get any data, and thus is won't LIST
or NLST or anything.
> - If all that doesn' work; any comments / suggestions
> how to process the various formats of directory listings?
Check out other open source program that parse listings. wget comes to mind,
as well as Bernstein's ftpparse: http://cr.yp.to/ftpparse.html
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.comReceived on 2003-01-09