diff options
author | Barney Gale <barney.gale@gmail.com> | 2024-06-23 21:01:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 21:01:12 (GMT) |
commit | 35e998f5608b04cdd331e67dd80d4829df71a5fd (patch) | |
tree | 44099e8e9ae00cad3684e3adb024fadcc7770050 /Misc/NEWS.d | |
parent | bc37ac7b440b5e816f0b3915b830404290522603 (diff) | |
download | cpython-35e998f5608b04cdd331e67dd80d4829df71a5fd.zip cpython-35e998f5608b04cdd331e67dd80d4829df71a5fd.tar.gz cpython-35e998f5608b04cdd331e67dd80d4829df71a5fd.tar.bz2 |
GH-73991: Add `pathlib.Path.copytree()` (#120718)
Add `pathlib.Path.copytree()` method, which recursively copies one
directory to another.
This differs from `shutil.copytree()` in the following respects:
1. Our method has a *follow_symlinks* argument, whereas shutil's has a
*symlinks* argument with an inverted meaning.
2. Our method lacks something like a *copy_function* argument. It always
uses `Path.copy()` to copy files.
3. Our method lacks something like a *ignore_dangling_symlinks* argument.
Instead, users can filter out danging symlinks with *ignore*, or
ignore exceptions with *on_error*
4. Our *ignore* argument is a callable that accepts a single path object,
whereas shutil's accepts a path and a list of child filenames.
5. We add an *on_error* argument, which is a callable that accepts
an `OSError` instance. (`Path.walk()` also accepts such a callable).
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Library/2024-06-19-03-09-11.gh-issue-73991.lU_jK9.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-06-19-03-09-11.gh-issue-73991.lU_jK9.rst b/Misc/NEWS.d/next/Library/2024-06-19-03-09-11.gh-issue-73991.lU_jK9.rst new file mode 100644 index 0000000..60a1b68 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-06-19-03-09-11.gh-issue-73991.lU_jK9.rst @@ -0,0 +1 @@ +Add :meth:`pathlib.Path.copytree`, which recursively copies a directory. |