cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Sending file over SFTP can overwrite existing files

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 14 Jan 2011 14:03:33 +0100 (CET)

On Thu, 13 Jan 2011, balsamik1 wrote:

> I have just discovered that sending files over SFTP with curl can overwrite
> existing files on the remote server without any warning.

That goes the same for all protocols curl supports. You can easily shoot
yourself in the foot. Be careful.

> it will work each time simply overwriting the remote file regardless what
> file I use as the local file.

Would you have expected a note about this in the documentation or did you just
assume that it would warn you?

> Is there any way to prevent the accidental overwrite from happening?

Only if you script a first check for the remote file's existance and then do
the upload in a second command if's not there. We don't have any
"if-not-already-there-upload" option for curl.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
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 2011-01-14