diff options
author | jab <jab@users.noreply.github.com> | 2018-12-28 18:03:40 (GMT) |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2018-12-28 18:03:40 (GMT) |
commit | 9e00d9e88fbf943987e4771c753f5ca8f794103e (patch) | |
tree | 4f6e77270b48e56f29fcc1c0dab1151842f2c17a /Doc/library/shutil.rst | |
parent | ed57e13df60ce28ba89bd49c9c5a15b1d9bf79c7 (diff) | |
download | cpython-9e00d9e88fbf943987e4771c753f5ca8f794103e.zip cpython-9e00d9e88fbf943987e4771c753f5ca8f794103e.tar.gz cpython-9e00d9e88fbf943987e4771c753f5ca8f794103e.tar.bz2 |
bpo-20849: add dirs_exist_ok arg to shutil.copytree (patch by Josh Bronson)
Diffstat (limited to 'Doc/library/shutil.rst')
-rw-r--r-- | Doc/library/shutil.rst | 19 |
1 files changed, 12 insertions, 7 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 |