cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question on using libcurl for FTP.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 24 Jun 2003 17:03:51 +0200 (CEST)

On Tue, 24 Jun 2003, Wei Weng wrote:

> Since I am such a newbie to libcurl, how do I get the FTP directory listing?

Use an FTP URL that ends with slash, like: ftp://host.com/directory/name/

> Should I issue a "LIST" command?

That will make it use LIST. If you rather have it do NLST, you can it do that
by setting CURLOPT_FTPLISTONLY or using CURLOPT_CUSTOMREQUEST.

> And if that is way to do it, how do I get the content returned by "LIST"
> command?

The same way you get contents from any URL, you specify and code your own
write callback.

FTP directory listings are server-specific, there is no standardized format
what it should look like. You need a clever directory parser function for
this, like D. Bernstein's ftpparse: http://cr.yp.to/ftpparse.html

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
Received on 2003-06-24