curl-library
How to *securely* delete a file
Date: Thu, 23 Apr 2009 16:38:17 -0400
I need to download a file through FTP, and then delete the file.
However, it is very important that this file only be deleted after a
successful transfer. Which means if there's and error, or for whatever
reason the file hasn't transfered, the delete operation should be by-passed.
One obvious way to achieve the delete in a perfect world would
involve this:
headerlist = curl_slist_append(headerlist, "DELE the_file");
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist);
but I don't know what would happen in the event of a download failure.
Would the delete go through anyway? Should I download the file, verify
it's presence and size and only then issue another command to delete
file? I'm not quite sure how I would issue a lone command to delete a
file in libcurl.
Received on 2009-04-23