[issue8395] shutil.copytree() add a copy_func parameter.

Ray.Allen report at bugs.python.org
Wed Apr 14 06:29:29 CEST 2010


New submission from Ray.Allen <ysj.ray at gmail.com>:

The shutil.copytree() function copies the whole tree recursively, and copy one single regular file with copy2(). I hope it can be more powerful(), that is, allow specifying a customerized copy function, rather than copy2(). To be specific, add an optional keyword argument, named "copy_func" or something like, default to copy2.

It will be useful for doing some customerized filesystem tree copying.

For example, when writing something like the project install script, or update script, which need to ignore some file while copying the whole directory, or changing ".ini" file after copying, or rename the file name after copying. All the specific copy action can be done in our customerized copy function instead of copy2().

Is there anybody who has the same feature request? Or is there some other module already provides the same functionality?

If so, I can provide a patch for it.

Thanks!

----------
components: Library (Lib)
messages: 103111
nosy: ysj.ray
severity: normal
status: open
title: shutil.copytree() add a copy_func parameter.
type: feature request
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8395>
_______________________________________


More information about the Python-bugs-list mailing list