Re: libcurl and libssh2
Date: Fri, 16 Oct 2009 10:34:20 +0200
2009/10/16 Xu, Qiang (FXSGSC) <Qiang.Xu_at_fujixerox.com>:
>> -----Original Message-----
>> From: curl-library-bounces_at_cool.haxx.se
>> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Michael Wood
>> I have never used the -Q option myself, but I believe you
>> need something like this:
>> curl ... -Q "rm /path/to/test.txt" sftp://...
> After some tries, I've got it working:
> qxu@durian(pts/1):~/opensrc/curl-7.19.6/src$ ./curl -v -u qxu:fair123 sftp://184.108.40.206 -Q "rm /home/qxu/scan/test.txt"
> Althought it is working, there are some problems.
> 1. It won't work when the path to the file is written as "~/scan/test.txt".
This is not something I can help you with. Maybe a mailing list for
libssh2 would be a better place to ask about it?
> 2. Why the root directory of the sftp server is listed? In my quoted command, there isn't anything related to "ls".
This is because curl is designed to get or put stuff. In my opinion,
the -Q option was added on because it's useful, but curl is not really
designed for doing that sort of thing. So your command above
basically means, please fetch me sftp://220.127.116.11, but before you
do that, please send through "rm /home/qxu/scan/test.txt".
So even if you have the -Q, it will still send back the same thing as
if you did not have the -Q there.
> 3. It won't work when I want to remove a folder:
> qxu@durian(pts/1):~/opensrc/curl-7.19.6/src$ ./curl -v -u qxu:fair123 sftp://18.104.22.168/ -Q "rm -rf /home/qxu/scan/DOC.XSM"
> I can confirm the folder /home/qxu/scan/DOC.XSM does exist. Can't I use "rm -rf" to remove a folder? What else shall I use?
Those quote commands are not shell commands. They are SFTP protocol
commands (or something like that). So you can probably not use "rm
-rf". But I don't know what you can use instead. You will probably
have to ask the libssh2 people.
-- Michael Wood <esiotrot_at_gmail.com> ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2009-10-16