cURL / Mailing Lists / curl-users / Single Mail


cURL TODO : 15.3 prevent file overwriting

From: Deepak Singh <>
Date: Mon, 19 May 2014 10:59:24 +0000 (GMT)
Samsung Enterprise Portal mySingle

This is an attempt to fix one of the TO DO list activities in cURL.


Please find the description below:

Problem:  15.3 prevent file overwriting:  Add an option that prevents cURL from overwriting existing local files. When  used, and there already is an existing file with the target file name (either -O or -o), a number should be appended (and increased if already existing). So that index.html becomes first index.html.1 and then  index.html.2 etc.


Solution: Added a new option 'n' which can be used with 'O' and 'o' options to solve the above problem,

Now the file overwriting can be prevented by using 'n' option along with 'o' and 'O' options in following ways:

- curl  -On
- curl   --remote-name-no-overwrite
- curl –o manpage.html -n
- curl –-output manpage.html –-netrc
- curl --remote-name –-netrc
- curl –-output manpage.html –n
- curl –o manpage.html –-netrc
- curl -–remote-name –n
- curl  -O –-netrc


I have compiled and tested the code on Linux and Windows enviornment.

I have tried to maintain the consistency with existing code in terms of indentaion, naming and other basic coding guidelines.

I hope this patch will be accepted and is useful to reduce the TODO list in the curl open source.

I am also working on to provide the test cases for this patch. I will be sharing the same once this patch is applied.

I am using curl library for long and now I want to contribute to cURL project as well.

This is my first patch and I hope to contribute much more in coming days.


Please let me know for any concerns.


Thanks & Regards,

Deepak Singh



List admin:

Received on 2014-05-19