cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and deleting files from ftp server

From: lostsandman <lostsandman_at_gmail.com>
Date: Tue, 17 May 2005 17:11:58 +0100

i think i have figured it out.

basically the code i used to delete a file was also doing a LIST on the server.

doh!

FtpHelper::StatusCodeHelper FtpHelper::DeleteFile(const std::string &filename)
{
FileDeleteCallBackData fileDeleteCallBack;
struct curl_slist *list = NULL;
std::string ftpCommand = "DELE " + filename;
list = curl_slist_append(list, ftpCommand.c_str());
curl_easy_reset(m_curl);

//the offending line. once this line is removed the problem goes away
//curl_easy_setopt(m_curl, CURLOPT_URL, m_url.c_str());

curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, CallbackFunction);
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, &fileDeleteCallBack);
curl_easy_setopt(m_curl, CURLOPT_QUOTE, list);
if (m_verbose)
curl_easy_setopt(m_curl, CURLOPT_VERBOSE, TRUE);
CURLcode res = curl_easy_perform(m_curl);
if (CURLE_OK != res)
return StatusCodeHelper(STATUS_CODE_ERROR, curl_easy_strerror(res));

return StatusCodeHelper();
}

Many thanks to philippe hameau for pointing me on the right direction.

But its still doing many CWD / commands......

cheers

On 5/17/05, lostsandman <lostsandman_at_gmail.com> wrote:
> Here is complete source code of a sample program i just created. (i am
> not including the curl files with this email)
>
> For test i downloaded about 11k files (average size 10k) from a local
> ftp server (FileZilla Server version 0.9.3 beta) here are the results
> from the above program (times in seconds)
>
> Total number fo files downloaded 11860
> Total download time 197
> Total delete time 656
> Average download time 0.0166105
> Average delete time 0.055312
>
> I am not sure what i am doing wrong so that deletes are taking time.
> Any help will be greatly appreciated.
>
> thanks
>
> On 5/16/05, Daniel Stenberg <daniel-curl_at_haxx.se> wrote:
> > On Mon, 16 May 2005, lostsandman wrote:
> >
> > > This is what i do for delete a file
> > >
> > > ftpCommand = "DELE " + filename;
> > > list = curl_slist_append(list, ftpCommand.c_str());
> >
> > Is 'list' set to NULL before you use this? Otherwise you'll probably get some
> > odd effects.
> >
> > > i can't seem to find what i am doing wrong here.....
> >
> > Me neither, but it would be easier for us to understand what you are doing and
> > possibly detect a problem if you would post a complete and compilable example
> > that we can try on a local ftp server of ours.
> >
> > --
> > Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
> >
>
>
>
Received on 2005-05-17