aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Lacko <backup.rlacko@gmail.com>2013-04-19 14:03:36 +0200
committerRoman Lacko <backup.rlacko@gmail.com>2013-04-19 14:03:36 +0200
commit5c988857d7d74e52d70528fc5c326e8ef734b0a4 (patch)
tree49b6fbce527776dfa655e54457e4a0800895d8d1
parentb94621e57e5eec1666f7fb5112482c9b12803755 (diff)
Don't copy empty folders in copydir() function
-rw-r--r--utils.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/utils.py b/utils.py
index 1722fe6fa..f5d98d2e9 100644
--- a/utils.py
+++ b/utils.py
@@ -119,9 +119,6 @@ def copydir(src, dst, logger=None, filter=None, ignore=None, force=True,
names = os.listdir(src)
- if not os.path.exists(dst):
- os.makedirs(dst)
-
errors = []
for name in names:
srcname = os.path.join(src, name)
@@ -135,6 +132,8 @@ def copydir(src, dst, logger=None, filter=None, ignore=None, force=True,
if (filter is not None and not filter_match(name, filter)) or \
(ignore is not None and filter_match(name, ignore)):
continue
+ if not os.path.exists(dst):
+ os.makedirs(dst)
copyfile(srcname, dstname, logger, True, vars, subst_files_content)
# catch the Error from the recursive copytree so that we can
# continue with other files