cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftp client questions.

From: Juan Ignacio Hervás <jihervas_at_iies.es>
Date: Tue, 27 May 2003 09:40:58 +0200

I don't know if this help you. Have a look at this web site:
http://cr.yp.to/ftpparse.html

It is a useful source code to parse FTP LIST responses that I have used
with this simplify code:

curl_easy_setopt (curl, CURLOPT_USERPWD, login_password);
curl_easy_setopt(curl, CURLOPT_URL, fullPath);
headerlist = curl_slist_append (headerlist, "CWD MyDir");
curl_easy_setopt(curl, CURLOPT_QUOTE, headerlist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_checkdir);
curl_easy_setopt(curl, CURLOPT_FILE, &myData);
res = curl_easy_perform(curl);
curl_slist_free_all (headerlist);
curl_easy_setopt(curl, CURLOPT_QUOTE, NULL);

In the write function 'my_checkdir' is where I call the ftpparse function
line by line.
Regards.

At 10:09 26/05/2003 +0200, you wrote:
>On Mon, 26 May 2003, Kurt Knudsen wrote:
>
> > First time doing this so i dont know if im doing it right or not :)
>
>Welcome!
>
>(You should not reply to an earlier mail but instead post a new one with a
>relevant subject when you are in fact starting a totally new thread.)
>
> > Anyway, Im trying to convert my WinInet FTP Client (very basic) to cURL so
> > i can get some additional support for dates, if at all possible, the FTP
> > servers are glFTPd as far as i know.
>
>Dates over FTP is a mess. In general.
>
> > Here are my questions. Ive read the manual and most other examples and docs
> > I could find, and Im still rather confused. I need to login, cwd to a
> > directory, get a list of dirs in that directory, with dates preferably
> > (main reason im converting to curl), make that list of dirs into an array,
> > step through the array, going in each dir 1 at a time, and doing LIST
> > *.txt, pretty much convert FtpFindFirstFile()/FtpFindNextFile() to curl.
> > Grab all the files that match the *.txt, and go to the next dir, when it
> > finishes with the array, simply log off.
>
>And where did your efforts and tests stop because libcurl wouldn't let you or
>you couldn't understand where to go next?
>
> > I read the basic ftpget example and is simply not enough, does anyone know
> > of any examples that use curl for what i need..
>
>The examples in the release archives and on the web site are the ones I've
>got.
>
> > if it seems confusing let me know ill try my best to explain and/or post
> > code of the WinInet that i want to convert.
>
>I doubt that helps. Most of us here have never seen nor used WinInet and you
>won't get more help by that.
>
>I suggest you plunge into libcurl-hacking and you ask specific questions
>about libcurl and how to make things happen using libcurl.
>
> > I have it wrapped up in a class so if i convert to curl i wanted to keep
> > the same functions i use in the main program (GetFile(), Connect(), etc)
>
>I wouldn't be so sure I could maintain the same functinons as libcurl may
>introduce another paradigm of how to do this.
>
>--
> Daniel Stenberg -- curl: been grokking URLs since 1998
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: ObjectStore.
>If flattening out C++ or Java code to make your application fit in a
>relational database is painful, don't do it! Check out ObjectStore.
>Now part of Progress Software. http://www.objectstore.net/sourceforge

-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
Received on 2003-05-27