cURL / Mailing Lists / curl-users / Single Mail

curl-users

cURL TODO : 15.3 prevent file overwriting

From: Deepak Singh <deepak.sn_at_samsung.com>
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  http://curl.haxx.se/docs/manpage.html
- curl   --remote-name-no-overwrite  http://curl.haxx.se/docs/manpage.html
- curl –o manpage.html -n http://curl.haxx.se/docs/manpage.html
- curl –-output manpage.html –-netrc http://curl.haxx.se/docs/manpage.html
- curl --remote-name –-netrc http://curl.haxx.se/docs/manpage.html
- curl –-output manpage.html –n http://curl.haxx.se/docs/manpage.html
- curl –o manpage.html –-netrc http://curl.haxx.se/docs/manpage.html
- curl -–remote-name –n http://curl.haxx.se/docs/manpage.html
- curl  -O –-netrc http://curl.haxx.se/docs/manpage.html

 

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: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

201405191629038_4CBBEM6S.gif
Received on 2014-05-19