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

gh-98125: Adds no clobber argument to shutil copytree. #98126

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eroeum
Copy link

@eroeum eroeum commented Oct 9, 2022

Adds no-clobber argument to shutil copytree.

This will allow copytree to copy files only if they do not exist. For example, consider the following file structure.

.
├── dst
│   └── test2
└── src
    ├── test1
    └── test2
shutil.copytree("src", "dst", dirs_exist_ok=True)

will overwrite ./dst/test2 with the contents of ./src/test2 which is not always desired.

shutil.copytree("src", "dst", dirs_exist_ok=True, no_clobber=True)

will not overwrite any existing files.

@bedevere-bot
Copy link

bedevere-bot commented Oct 9, 2022

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Oct 9, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@eroeum eroeum force-pushed the gh-98125-add-no-clobber-argument-to-shutil-copytree branch from 51dc6a1 to 411da81 Compare Oct 10, 2022
@bedevere-bot
Copy link

bedevere-bot commented Oct 10, 2022

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

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

2 participants