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.

classification
Title: Improvements for shutil.copytree()
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, jlgijsbers, thomaswaldmann
Priority: normal Keywords: patch

Created on 2005-01-01 08:26 by georg.brandl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
shutil.diff georg.brandl, 2005-01-01 08:26 Patch
Messages (4)
msg47439 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-01-01 08:26
See bugs #975763 and #1048878.

The patch changes shutil.copytree() to use
os.makedirs() instead of os.mkdir() and to copy
directory bits using copystat(), because file bits are
copied, too.

It includes a doc change to mention these details.
msg47440 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2005-01-08 12:32
Logged In: YES 
user_id=469548

Applied on HEAD. Thanks for the patch! Log message:

Checking in Doc/lib/libshutil.tex;
/cvsroot/python/python/dist/src/Doc/lib/libshutil.tex,v  <--
 libshutil.tex
new revision: 1.16; previous revision: 1.15
done
Checking in Lib/shutil.py;
/cvsroot/python/python/dist/src/Lib/shutil.py,v  <--  shutil.py
new revision: 1.35; previous revision: 1.34
done
msg47441 - (view) Author: Thomas Waldmann (thomaswaldmann) Date: 2005-01-17 00:10
Logged In: YES 
user_id=100649

For files, the ctime and atime is copied, too, as part of
copystat() - directly AFTER copying the file.

But if the copystat() call for a directory is done BEFORE
filling that directory with files, the atime and mtime of
the directory will be changed by that again.

So better move the copystat call for the directory to after
the for loop.
msg47442 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2005-01-23 12:21
Logged In: YES 
user_id=469548

I see. I've moved the copystat call to after the loop in
rev. 1.36.
History
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41385
2005-01-01 08:26:42birkenfeldcreate