cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: SFTP - How to delete a file

From: Mathew Simon <msimon_at_simdol.com>
Date: Tue, 28 Aug 2007 21:42:27 -0500

Dan,

The versions I am using are the following.
Libssh2 - CVS-20070410. All later versions will not do SFTP when
compiled under Mingw32 on Windows platform. Guenter Knauf gave me this
version recently while I was having SFTP connect issues.

Libcurl - 7.16.4. Only this version of libcurl will work with the above
libssh2.

The results I get when using a simple "pwd" command as POSTQUOTE is
given below. Only the word "pwd" is there in the slist.

Text: Connected to xxx.xxxx.com (192.168.0.1) port 22 (#0)
Text: SSH authentication methods available:
publickey,password,keyboard-interactive
Text: Initialized password authentication
Text: Authentication complete
Text: Sending postquote commands
Text: Syntax error in SFTP command. Supply parameter(s)!
Text: Closing connection #0
Text: FTP: a quote command returned error

The Curl perform fails due to this error.

Thanks,
Mathew Simon

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
Sent: Tuesday, August 28, 2007 12:27 AM
To: curl-library_at_cool.haxx.se
Subject: Re: SFTP - How to delete a file

On Mon, Aug 27, 2007 at 11:57:51PM -0500, Mathew Simon wrote:
> I tried both the CURLOPT_QUOTE AND POSTQUOTE. But both are failing
> however way I tried to form the "rm" command.
>
> This is my situation.
> SFTP url= sftp://xxx.xxx.com/ReceiveFiles/filename1.txt
>
> I am able to download this file. But I am unable to delete this file
> using either CURLOPT_QUOTE or POSTQUOTE. If I use CURLOPT_QUOTE, most
> of the time the download is also failing and I get the verbose output
> of "malformed url" error.
>
> I tried the following combinations
> RM filename1.txt
> RM ReceiveFiles/filename1.txt
> RM /ReceiveFiles/filename1.txt
> RM xxx.xxx.com/ReceiveFiles/filename1.txt
> RM sftp://xxx.xxx.com/ReceiveFiles/filename1.txt
>
> I am not sure which form of the "RM" command I should use. Any
> suggestions?

"rm" takes an absolute path name, so I would have expected the
RM /ReceiveFiles/filename1.txt form to work.

> Also, I tried to give a simple "pwd" command as CURLOPT_POSTQUOTE, and

> this is the only command in the slist. But this is also failing, and
> the verbose output massage talks about giving parameters to the SFTP
> quote command. I have no idea what is happening.

That should also have worked. What version of libcurl are you using?
And what are the exact options and error messages you're seeing? Have
you tried doing the same operations using the curl command-line client
to rule out a problem with your program?

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address
service
          Let webmasters know that your web site has moved
Received on 2007-08-29