cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Remove remote file issue using CURL SFTP

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 9 Jul 2010 15:54:10 -0700

On Fri, Jul 09, 2010 at 05:49:30PM -0400, Sharma, Meghnath wrote:
> I am using CURL SFTP to download the file and once downloaded, delete the
> remote file. I have a test machine (TEST A) within my company and a test
> machine on the client site (TEST B). The curl feature works for me on TEST A,
> but it doesn?t work on TEST B.

I see at least one difference between the two servers:

> TEST A: download and then deletion works beautifully
>
> $ curl -v -u testuser:testpwd -O sftp://qzftap/~/testt.txt -Q '-rm testt.txt'

Here, you download the file ~/testt.txt and delete testt.txt.

> TESTB: download works but deletion fails
>
> $ curl -v -u adc_xfer: -O --key /apps2/edi/.ssh/id_rsa --pubkey /apps2/edi/.ssh
> /id_rsa.pub sftp://secureftp.ppp.com:10022/testt.txt -Q '-rm testt.txt'

Here, you download the file /testt.txt and delete testt.txt. It's likely
that the server does not place you in the right place for the "rm" to work
in both cases (probably the latter). Try specifying an absolute path to the
file in the second case, e.g. '-rm /testt.txt' or maybe '-rm ~/testt.txt'
The 'pwd' command should tell you where you are when you log in.

Another possibility is that the server still has a handle to the file open
when the "rm" command comes in, which is a situation that some servers can't
handle (e.g. Windows). Try removing the "-" from the '-rm testt.txt" command
and start a dummy sftp transfer to see if the file is removed in that case.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-10