This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author arandrea
Recipients
Date 2006-08-14.16:49:58
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
It would be nice to be able to choose which of the copy
functions is used in copytree.  I am currently working
on a project where I would like to copy a tree, but I
do not want to preserve permissions so I'd like
copytree to use copyfile instead of copy2.

Here is a snippet of copytree from shutil.py that I
modified by adding a func parameter and defaulting it
to copy2.

def copytree(src, dst, symlinks=False, func=copy2):
.
.
.
        try:
            if symlinks and os.path.islink(srcname):
                linkto = os.readlink(srcname)
                os.symlink(linkto, dstname)
            elif os.path.isdir(srcname):
                copytree(srcname, dstname, symlinks)
            else:
                func(srcname, dstname)
.
.
.
History
Date User Action Args
2008-01-20 09:59:50adminlinkissue1540112 messages
2008-01-20 09:59:50admincreate