Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl: add --no-clobber #7708

Closed
wants to merge 8 commits into from
Closed

curl: add --no-clobber #7708

wants to merge 8 commits into from

Conversation

Hex052
Copy link
Contributor

@Hex052 Hex052 commented Sep 12, 2021

I have no idea how to write a test that would cover this, if someone could help me with writing some, I'll happily add them!

This is something from the TODO list:

18.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.

@vszakats vszakats changed the title Avoid/enforce overwriting files files Avoid/enforce overwriting files Sep 17, 2021
@Hex052
Copy link
Contributor Author

@Hex052 Hex052 commented Sep 20, 2021

@jay could I get some help writing some unit tests for this? Sorry if you're the wrong person to ask!

@jay
Copy link
Member

@jay jay commented Sep 24, 2021

FYI it looks like this was attempted once in 2014
https://curl.se/mail/archive-2014-05/0014.html

docs/cmdline-opts/no-clobber.d Outdated Show resolved Hide resolved
docs/options-in-versions Outdated Show resolved Hide resolved
src/tool_help.c Outdated Show resolved Hide resolved
@bagder
Copy link
Member

@bagder bagder commented Oct 7, 2021

@Hex052 can you please fix the merge issue and force-push an update? Then I can have a look at making a test case or two for this!

@Hex052
Copy link
Contributor Author

@Hex052 Hex052 commented Oct 12, 2021

bagder pushed a commit to Hex052/curl that referenced this issue Feb 26, 2022
Does not overwrite output files if they already exist
Closes curl#7708
@bagder bagder changed the title Avoid/enforce overwriting files curl: add --no-clobber Feb 26, 2022
@bagder
Copy link
Member

@bagder bagder commented Feb 26, 2022

I rebased, squashed and took the liberty to force-push.

@bagder
Copy link
Member

@bagder bagder commented Feb 26, 2022

It struck me that -w "%{filename_effective}" needs a tweak to work with this.

Hex052 and others added 3 commits Mar 10, 2022
Does not overwrite output files if they already exist
Closes curl#7708
bagder added a commit that referenced this issue Mar 10, 2022
Detected while working on #7708 that happened to trigger an error here
with a new test case.
bagder added a commit that referenced this issue Mar 10, 2022
Detected while working on #7708 that happened to trigger an error here
with a new test case.

Closes #8572
@bagder
Copy link
Member

@bagder bagder commented Mar 10, 2022

@Hex052 I'm getting close to merging this PR. Do you want to be credited as HexTheDragon for this change?

@bagder
Copy link
Member

@bagder bagder commented Mar 11, 2022

Thanks!

@Hex052
Copy link
Contributor Author

@Hex052 Hex052 commented Mar 13, 2022

@Hex052 I'm getting close to merging this PR. Do you want to be credited as HexTheDragon for this change?

Sure, that works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants