cURL / Mailing Lists / curl-library / Single Mail

curl-library

problem with rename a remote sFTP file

From: changqin_gang <changqin_gang_at_sina.com>
Date: Mon, 20 Oct 2008 18:03:08 +0800

the code below seems not to work for me,one time it turns back success information,bu the remote file keeps same as old, next time it shows:Unknown SFTP command!

what's wrong?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct curl_slist * headerlist = NULL;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CString command_renamefrom = "RNFR ";
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CString command_renameto = "RNTO ";
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CString CommandBuffer_renamefrom = command_renamefrom + OldFilename;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CString CommandBuffer_renameto = command_renameto + NewFilename;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* specify target */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; curl_easy_setopt(hCurl, CURLOPT_URL, sFtpFilePath);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/* pass commands to libcurl list */
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;headerlist = curl_slist_append(headerlist, CommandBuffer_renamefrom);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;headerlist = curl_slist_append(headerlist, CommandBuffer_renameto);

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;/* pass in that last of sFTP commands to run */
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;curl_easy_setopt(hCurl, CURLOPT_POSTQUOTE, headerlist);

&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;curl_easy_setopt(hCurl, CURLOPT_USERPWD, bsUserPassword);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*perform now! */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nCurlResult = curl_easy_perform(hCurl);

-------------------------------------------------------------------
新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )
Received on 2008-10-20