@@ -230,9 +230,8 @@ Directory and files operations
230
230
dirs_exist_ok=False)
231
231
232
232
Recursively copy an entire directory tree rooted at *src * to a directory
233
- named *dst * and return the destination directory. *dirs_exist_ok * dictates
234
- whether to raise an exception in case *dst * or any missing parent directory
235
- already exists.
233
+ named *dst * and return the destination directory. All intermediate
234
+ directories needed to contain *dst * will also be created by default.
236
235
237
236
Permissions and times of directories are copied with :func: `copystat `,
238
237
individual files are copied using :func: `~shutil.copy2 `.
@@ -263,8 +262,14 @@ Directory and files operations
263
262
264
263
If *copy_function * is given, it must be a callable that will be used to copy
265
264
each file. It will be called with the source path and the destination path
266
- as arguments. By default, :func: `~shutil.copy2 ` is used, but any function
267
- that supports the same signature (like :func: `~shutil.copy `) can be used.
265
+ as arguments. By default, :func: `~shutil.copy2 ` is used, but any function
266
+ that supports the same signature (like :func: `~shutil.copy `) can be used.
267
+
268
+ If *dirs_exist_ok * is false (the default) and *dst * already exists, a
269
+ :exc: `FileExistsError ` is raised. If *dirs_exist_ok * is true, the copying
270
+ operation will continue if it encounters existing directories, and files
271
+ within the *dst * tree will be overwritten by corresponding files from the
272
+ *src * tree.
268
273
269
274
.. audit-event :: shutil.copytree src,dst shutil.copytree
270
275
@@ -275,7 +280,7 @@ Directory and files operations
275
280
.. versionchanged :: 3.2
276
281
Added the *copy_function * argument to be able to provide a custom copy
277
282
function.
278
- Added the *ignore_dangling_symlinks * argument to silent dangling symlinks
283
+ Added the *ignore_dangling_symlinks * argument to silence dangling symlinks
279
284
errors when *symlinks * is false.
280
285
281
286
.. versionchanged :: 3.8
0 commit comments