mirror of https://github.com/python/cpython
shutil copy module reference doc fix.
This commit is contained in:
parent
f4ab491901
commit
7f728c1e1a
|
@ -21,8 +21,8 @@ copying and removal. For operations on individual files, see also the
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Even the higher-level file copying functions (:func:`copy`, :func:`copy2`)
|
Even the higher-level file copying functions (:func:`shutil.copy`,
|
||||||
cannot copy all file metadata.
|
:func:`shutil.copy2`) cannot copy all file metadata.
|
||||||
|
|
||||||
On POSIX platforms, this means that file owner and group are lost as well
|
On POSIX platforms, this means that file owner and group are lost as well
|
||||||
as ACLs. On Mac OS, the resource fork and other metadata are not used.
|
as ACLs. On Mac OS, the resource fork and other metadata are not used.
|
||||||
|
@ -49,10 +49,10 @@ Directory and files operations
|
||||||
|
|
||||||
.. function:: copyfile(src, dst)
|
.. function:: copyfile(src, dst)
|
||||||
|
|
||||||
Copy the contents (no metadata) of the file named *src* to a file named *dst*.
|
Copy the contents (no metadata) of the file named *src* to a file named
|
||||||
*dst* must be the complete target file name; look at :func:`copy` for a copy that
|
*dst*. *dst* must be the complete target file name; look at
|
||||||
accepts a target directory path. If *src* and *dst* are the same files,
|
:func:`shutil.copy` for a copy that accepts a target directory path. If
|
||||||
:exc:`Error` is raised.
|
*src* and *dst* are the same files, :exc:`Error` is raised.
|
||||||
The destination location must be writable; otherwise, an :exc:`IOError` exception
|
The destination location must be writable; otherwise, an :exc:`IOError` exception
|
||||||
will be raised. If *dst* already exists, it will be replaced. Special files
|
will be raised. If *dst* already exists, it will be replaced. Special files
|
||||||
such as character or block devices and pipes cannot be copied with this
|
such as character or block devices and pipes cannot be copied with this
|
||||||
|
@ -82,9 +82,9 @@ Directory and files operations
|
||||||
|
|
||||||
.. function:: copy2(src, dst)
|
.. function:: copy2(src, dst)
|
||||||
|
|
||||||
Similar to :func:`copy`, but metadata is copied as well -- in fact, this is just
|
Similar to :func:`shutil.copy`, but metadata is copied as well -- in fact,
|
||||||
:func:`copy` followed by :func:`copystat`. This is similar to the
|
this is just :func:`shutil.copy` followed by :func:`copystat`. This is
|
||||||
Unix command :program:`cp -p`.
|
similar to the Unix command :program:`cp -p`.
|
||||||
|
|
||||||
|
|
||||||
.. function:: ignore_patterns(\*patterns)
|
.. function:: ignore_patterns(\*patterns)
|
||||||
|
@ -97,10 +97,10 @@ Directory and files operations
|
||||||
.. function:: copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False)
|
.. function:: copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2, ignore_dangling_symlinks=False)
|
||||||
|
|
||||||
Recursively copy an entire directory tree rooted at *src*. The destination
|
Recursively copy an entire directory tree rooted at *src*. The destination
|
||||||
directory, named by *dst*, must not already exist; it will be created as well
|
directory, named by *dst*, must not already exist; it will be created as
|
||||||
as missing parent directories. Permissions and times of directories are
|
well as missing parent directories. Permissions and times of directories
|
||||||
copied with :func:`copystat`, individual files are copied using
|
are copied with :func:`copystat`, individual files are copied using
|
||||||
:func:`copy2`.
|
:func:`shutil.copy2`.
|
||||||
|
|
||||||
If *symlinks* is true, symbolic links in the source tree are represented as
|
If *symlinks* is true, symbolic links in the source tree are represented as
|
||||||
symbolic links in the new tree, but the metadata of the original links is NOT
|
symbolic links in the new tree, but the metadata of the original links is NOT
|
||||||
|
@ -126,10 +126,10 @@ Directory and files operations
|
||||||
|
|
||||||
If exception(s) occur, an :exc:`Error` is raised with a list of reasons.
|
If exception(s) occur, an :exc:`Error` is raised with a list of reasons.
|
||||||
|
|
||||||
If *copy_function* is given, it must be a callable that will be used
|
If *copy_function* is given, it must be a callable that will be used to copy
|
||||||
to copy each file. It will be called with the source path and the
|
each file. It will be called with the source path and the destination path
|
||||||
destination path as arguments. By default, :func:`copy2` is used, but any
|
as arguments. By default, :func:`shutil.copy2` is used, but any function
|
||||||
function that supports the same signature (like :func:`copy`) can be used.
|
that supports the same signature (like :func:`copy`) can be used.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
Added the *copy_function* argument to be able to provide a custom copy
|
Added the *copy_function* argument to be able to provide a custom copy
|
||||||
|
@ -172,8 +172,8 @@ Directory and files operations
|
||||||
:func:`os.rename` semantics.
|
:func:`os.rename` semantics.
|
||||||
|
|
||||||
If the destination is on the current filesystem, then :func:`os.rename` is
|
If the destination is on the current filesystem, then :func:`os.rename` is
|
||||||
used. Otherwise, *src* is copied (using :func:`copy2`) to *dst* and then
|
used. Otherwise, *src* is copied (using :func:`shutil.copy2`) to *dst* and
|
||||||
removed.
|
then removed.
|
||||||
|
|
||||||
|
|
||||||
.. exception:: Error
|
.. exception:: Error
|
||||||
|
|
Loading…
Reference in New Issue