diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -104,8 +104,8 @@ copied with :func:`copystat`, individual files are copied using :func:`copy2`. - If *symlinks* is true, symbolic links in the source tree are represented as - symbolic links in the new tree; if false or omitted, the contents of the + If *symlinks* is ``True``, symbolic links in the source tree are represented as + symbolic links in the new tree; if ``False`` or omitted, the contents of the linked files are copied to the new tree. If *ignore* is given, it must be a callable that will receive as its @@ -140,8 +140,8 @@ .. index:: single: directory; deleting Delete an entire directory tree; *path* must point to a directory (but not a - symbolic link to a directory). If *ignore_errors* is true, errors resulting - from failed removals will be ignored; if false or omitted, such errors are + symbolic link to a directory). If *ignore_errors* is ``True``, errors resulting + from failed removals will be ignored; if ``False`` or omitted, such errors are handled by calling a handler specified by *onerror* or, if that is omitted, they raise an exception. @@ -163,15 +163,23 @@ Recursively move a file or directory to another location. - If the destination is on the current filesystem, then simply use rename. - Otherwise, copy src (with :func:`copy2`) to the dst and then remove src. + If the destination *dst* is a directory or a symlink to a directory, then + *src* is moved inside that directory. + + The destination directory must not already exist. If the destination already + exists but is not a directory, it may be overwritten depending on + :func:`os.rename` semantics. + + If the destination is on the current filesystem, then :func:`os.rename` is + used. Otherwise, *src* is copied (using :func:`copy2`) to the *dst* and then + removed. .. versionadded:: 2.3 .. exception:: Error - This exception collects exceptions that raised during a multi-file operation. For + This exception collects exceptions that are raised during a multi-file operation. For :func:`copytree`, the exception argument is a list of 3-tuples (*srcname*, *dstname*, *exception*). @@ -275,7 +283,7 @@ .. function:: get_archive_formats() - Returns a list of supported formats for archiving. + Return a list of supported formats for archiving. Each element of the returned sequence is a tuple ``(name, description)`` By default :mod:`shutil` provides these formats: @@ -293,7 +301,7 @@ .. function:: register_archive_format(name, function, [extra_args, [description]]) - Registers an archiver for the format *name*. *function* is a callable that + Register an archiver for the format *name*. *function* is a callable that will be used to invoke the archiver. If given, *extra_args* is a sequence of ``(name, value)`` that will be