cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: SFTP Command Execution

From: Xu, Qiang (FXSGSC) <Qiang.Xu_at_fujixerox.com>
Date: Wed, 7 Jul 2010 16:55:41 +0800

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Paul Romero
> Sent: Monday, July 05, 2010 2:25 AM
> To: curl-library_at_cool.haxx.se
> Subject: SFTP Command Execution
>
> Dear Group:
>
> It seem that CURLOPT_QUOTE and CURLOPT_PREQUOTE don't work
> for libcurl 7.21.0 for SFTP. For instance, consider the
> following example:
>
> struct curl_slist *paction = NULL;
> ....
> curl_slist_append(paction, "rm x.c");
> curl_easy_setopt(hnd, CURLOPT_QUOTE, paction);
> ...
> curl_perform(hnd);
>
> The connection to the SFTP server works and the file is
> fetched but the file x.c is not removed. Also, I am not sure
> how to verify that the rm command--or any other succeeded,
> with the API. Does this feature work, and if so, is there
> something important I am forgetting ?

Your code seems all right. The only possible reason of the failure I can think of is the path. Try setting a full path to the remove command, for example, curl_slist_append(paction, "rm /home/paul/x.c"), to see whether it works. I have used the similar code to do a remote remove, and it works (only when the full path is given).

If it still doesn't work, try to open the debug switch (of course, your libssh2 library must be compiled with the option --enable-debug) and capture the trace for analysis.

Regards,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-07