cURL / Mailing Lists / curl-library / Single Mail

curl-library

Prevent directory listing when removing a file

From: pcworld <0188801_at_googlemail.com>
Date: Fri, 14 Jan 2011 17:34:39 +0100

Hello!

I want to delete files from a FTP server, but I always get a directory
listing too, which I don't want. Deleting the file works.
Options I set:

curl_easy_setopt(curl, CURLOPT_PASSWORD, pw.c_str());
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 0);
curl_easy_setopt(curl, CURLOPT_URL, ""ftp://username@localhost");

Delete command:

struct curl_slist *headerlist = NULL;
string cmd = "DELE /myfile.txt";
headerlist = curl_slist_append(headerlist, cmd.c_str());
curl_easy_setopt(curl, CURLOPT_QUOTE, headerlist);

CURLcode res;
res = curl_easy_perform(curl);

curl_easy_cleanup(curl);
if (CURLE_OK != res) {
   fprintf(stderr, "curl told us %d\n", res);
}

How can I prevent libcurl from doing a directory listing?

Thank you!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-14