cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: -J "Refusing to overwrite..."

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 31 May 2014 23:17:57 +0200 (CEST)

On Thu, 29 May 2014, Mo Cassidy wrote:

> If I run `curl -O http://example.com/somepath/someresource`, curl will save
> the output to `someresource` in the current directory. If I run the same
> command over and over, it keeps overwriting the file.
> If I run `curl -O -J http://example.com/somepath/someresource`, it will use
> whatever the server sends in the `Content-Disposition` header as the
> filename (let's say it's "mydownload.txt"). However subsequently running
> the same command causes cURL to output
>
> Warning: Refusing to overwrite what_it_is.png: File exists
>
> then...
>
> curl: (23) Failed writing body (0 != 29)
>
> It seems like the inconsistent behaviour will cause confusion. Is there
> some way to force cURL to overwrite the file?

No, there's no way to do that. I'd say the new pending --clobber option could
be used for this.

The idea for this refusal is of course that a user can't really tell what file
name the server will return with so it is a safety precaution to act like
this.

-- 
  / 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 2014-05-31