From 926d45bb4eb6b85b58586c027fe5e4b3467d4dc7 Mon Sep 17 00:00:00 2001 From: Johannes Gijsbers Date: Sun, 23 Jan 2005 12:20:15 +0000 Subject: [PATCH] shutil.copytree: move copystat call for the directory after the loop copying files inside the directory, as that loop changes the atime and mtime. --- Lib/shutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/shutil.py b/Lib/shutil.py index d6e7d18e149..baedd4cd962 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -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