Running 'curl' with '-o' option failed with error "curl: (23) Failed writing body (0 != 720)"

Brian Inglis
Fri Jun 21 20:36:00 GMT 2019

On 2019-06-21 01:40, Ma Hao wrote:
> On 2019年06月21日 15点37分, Csaba Raduly wrote: 
>> On Fri, Jun 21, 2019 at 9:28 AM Ma Hao wrote:
>>> I was running into the problem when I tried to download spring:
>>> $ curl -o /home/cdmahao/
>> You told curl to write the download to a file named /home/cdmahao/
>> Unfortunately, there is already a directory named /home/cdmahao/, and
>> curl can't write a file to a directory.
>> You need to give the name of a file to -o
>> $ curl
>> -o /home/cdmahao/
>> curl works differently from wget. wget invents a filename based on the
>> URL. curl does not do that.
> Thanks for pointing that out.Appreciate your quick responding.

To make curl operate more like wget when downloading files, use curl -JOR where:

-O,--remote-name uses the trailing URL component as the filename to save;

-J,--remote-header-name works with -O,--remote-name to use the server
Content-Disposition header filename if available, instead of the trailing URL
component, as the filename to save;

-R,--remote-time is like wget -N,--timestamping and uses the remote file
modified time stamp if available;

--remote-name-all enables -O for all URLs specified in the command.

Note that curl will only download into the current directory and never
overwrites existing files, whereas wget supports -P,--directory-prefix=prefix,
and wget requires -nc,--no-clobber to suppress version suffixing the file names
of, or overwriting, existing files depending on other options specified.

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list