from http://curl.haxx.se/libcurl/c/libcurl-errors.html 21 is "quote" error... a bit weirdly named, but apparently when rm was broken around 2007 (per mailing list), same error popped up.
the command line example at the time was curl sftp://.../path/to/file.txt --quote rm Perhaps someone can correct me if that changed. someone appears to have solved related issue by doing url sftp://server/ and quoted command rm "/path/to/file.txt" http://curl.haxx.se/mail/lib-2012-05/0101.html good luck! On 11 December 2013 06:19, 刘英伟 <[email protected]> wrote: > I want to delete file from sftp > this is my code : > curl_global_init(CURL_GLOBAL_DEFAULT); > curl = curl_easy_init(); > curl_easy_setopt(curl, CURLOPT_URL, > "sftp://admin:[email protected]:22/ogsapp/tmp/hebh/sftptest/"); > headerlist = curl_slist_append(headerlist, "rm abc.c"); > result = curl_easy_setopt(curl, CURLOPT_POSTQUOTE, headerlist); > printf("%d\n",result); > result = curl_easy_perform(curl); > printf("%d\n",result); > > > > but the abc.c is still exist and the curl_code is 21 . > > ------------------------------------------------------------------- > List admin: http://cool.haxx.se/list/listinfo/curl-library > Etiquette: http://curl.haxx.se/mail/etiquette.html ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
