[ python-Feature Requests-1540112 ] Allow choice of copy function in shutil.copytree
SourceForge.net
noreply at sourceforge.net
Mon Aug 14 18:50:02 CEST 2006
Feature Requests item #1540112, was opened at 2006-08-14 09:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1540112&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tony (arandrea)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow choice of copy function in shutil.copytree
Initial Comment:
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)
.
.
.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1540112&group_id=5470
More information about the Python-bugs-list
mailing list