cURL / Mailing Lists / curl-library / Single Mail

curl-library

deleting a file from ftp server

From: Magesh Dhasayyan <mag.1984_at_gmail.com>
Date: Mon, 15 Mar 2010 15:41:55 -0400

Hi,

I want to use libcurl to,
(1) download a file from a ftp server // RETR <filename>
(2) delete it // DELE <filename>

I want both (1) and (2) to be under separate functions with a common
handle to maintain a persistent connection between usages of RETR and
DELE.

I used URL "ftp://ftpserv1/curltest.xml" to download the file. It worked fine.

curltest.cpp
-----------------
{
    CURL *handle;
    // some code to download file "ftp://ftpserv1/curltest.xml"
    // download successful
    curl_easy_reset(handle);

    // delete code and issues shown below

    // URL try 1: does a "DELE <filename>" followed by a direcotry
listing (undesirable)
    curl_easy_setopt(handle, CURLOPT_URL, "ftp://ftpserv1")

    // URL try 2: does a "DELE <filename>" followed by an attempt to
download file (undesirable)
    curl_easy_setopt(handle, CURLOPT_URL, "ftp://ftpserv1/curltest.xml")
}

In both the tries, "DELE <filename>" is successful, but after that it
continues to do something else which I'm trying to avoid. How do i set
an option to make curl stop after a successful "DELE".
Please advise. Please let me know if you need further information.

Thanks
Magesh
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-15