shutil.copytree: move copystat call for the directory after the loop

copying files inside the directory, as that loop changes the atime and
mtime.
This commit is contained in:
Johannes Gijsbers 2005-01-23 12:20:15 +00:00
parent 8e3ca8af26
commit 926d45bb4e
1 changed files with 1 additions and 1 deletions

View File

@ -109,7 +109,6 @@ def copytree(src, dst, symlinks=False):
"""
names = os.listdir(src)
os.makedirs(dst)
copystat(src, dst)
errors = []
for name in names:
srcname = os.path.join(src, name)
@ -125,6 +124,7 @@ def copytree(src, dst, symlinks=False):
# XXX What about devices, sockets etc.?
except (IOError, os.error), why:
errors.append((srcname, dstname, why))
copystat(src, dst)
if errors:
raise Error, errors