diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 19 | ||||
-rw-r--r-- | Doc/whatsnew/3.8.rst | 9 |
2 files changed, 20 insertions, 8 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 7a596ee..427a120 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -209,14 +209,16 @@ Directory and files operations .. function:: copytree(src, dst, symlinks=False, ignore=None, \ - copy_function=copy2, ignore_dangling_symlinks=False) + copy_function=copy2, ignore_dangling_symlinks=False, \ + dirs_exist_ok=False) - Recursively copy an entire directory tree rooted at *src*, returning the - destination directory. The destination - directory, named by *dst*, must not already exist; it will be created as - well as missing parent directories. Permissions and times of directories - are copied with :func:`copystat`, individual files are copied using - :func:`shutil.copy2`. + Recursively copy an entire directory tree rooted at *src* to a directory + named *dst* and return the destination directory. *dirs_exist_ok* dictates + whether to raise an exception in case *dst* or any missing parent directory + already exists. + + Permissions and times of directories are copied with :func:`copystat`, + individual files are copied using :func:`shutil.copy2`. If *symlinks* is true, symbolic links in the source tree are represented as symbolic links in the new tree and the metadata of the original links will @@ -262,6 +264,9 @@ Directory and files operations copy the file more efficiently. See :ref:`shutil-platform-dependent-efficient-copy-operations` section. + .. versionadded:: 3.8 + The *dirs_exist_ok* parameter. + .. function:: rmtree(path, ignore_errors=False, onerror=None) .. index:: single: directory; deleting diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 2d45e7e..c592f00 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -196,6 +196,14 @@ pathlib contain characters unrepresentable at the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.) + +shutil +------ + +:func:`shutil.copytree` now accepts a new ``dirs_exist_ok`` keyword argument. +(Contributed by Josh Bronson in :issue:`20849`.) + + ssl --- @@ -284,7 +292,6 @@ Optimizations syscalls is reduced by 38% making :func:`shutil.copytree` especially faster on network filesystems. (Contributed by Giampaolo Rodola' in :issue:`33695`.) - * The default protocol in the :mod:`pickle` module is now Protocol 4, first introduced in Python 3.4. It offers better performance and smaller size compared to Protocol 3 available since Python 3.0. |