diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-04-19 22:30:51 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2010-04-19 22:30:51 (GMT) |
commit | 5340db38034557204de5629a4a136d0da2acd3c4 (patch) | |
tree | 19162e5a8ffb291853eb5fd238fa394d2076d45c /Doc | |
parent | 5fb313bb04dae9bbae82d5ca16ee1cc4e02a5e47 (diff) | |
download | cpython-5340db38034557204de5629a4a136d0da2acd3c4.zip cpython-5340db38034557204de5629a4a136d0da2acd3c4.tar.gz cpython-5340db38034557204de5629a4a136d0da2acd3c4.tar.bz2 |
Fixed #1540112: now shutil.copytree will let you provide your own copy() function
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/shutil.rst | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index 9d06903..8b9ee8e 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -87,7 +87,7 @@ Directory and files operations match one of the glob-style *patterns* provided. See the example below. -.. function:: copytree(src, dst, symlinks=False, ignore=None) +.. function:: copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2) 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 @@ -111,9 +111,14 @@ Directory and files operations If exception(s) occur, an :exc:`Error` is raised with a list of reasons. - The source code for this should be considered an example rather than the - ultimate tool. + If *copy_function* is given, it must be a callable that will be used + to copy each file. It will be called with the source path and the + destination path as arguments. By default, :func:`copy2` is used, but any + function that supports the same signature (like :func:`copy`) can be used. + .. versionchanged:: 3.2 + Added the *copy_function* argument to be able to provide a custom copy + function. .. function:: rmtree(path, ignore_errors=False, onerror=None) |