cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_QUOTE SFTP filename with spaces

From: Khaled El Manawhly <k.elmanawhly_at_gmail.com>
Date: Mon, 21 Jan 2013 00:30:37 -0500

Hi, I'm having some trouble renaming to a file with spaces on an SSH server
with this code:

curl_slist *ren = NULL;
 char szMessage[1024];
sprintf(szMessage, "rename \"/testdir/test.txt\" \"/testdir/renamed
test.txt\"");
 ren=curl_slist_append(ren, szMessage);

curl_easy_setopt(hCurl, CURLOPT_QUOTE, ren);

CURLcode ccCurlResult = curl_easy_perform(hCurl);

if (ccCurlResult == CURLE_OK)
printf("File renamed successfully.\n");
else
printf("File renaming failed. Curl error: %d\n",ccCurlResult);

curl_easy_setopt(hCurl,CURLOPT_QUOTE,NULL);
curl_slist_free_all(ren);

It actually performs the rename, but returns an error 78. The second time
around, it doesn't rename, returning an error 21. I wish I knew what was
going on.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-21