mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
recursively merge directory trees
This commit is contained in:
parent
ec6886dbf2
commit
425341152f
1 changed files with 5 additions and 2 deletions
|
@ -24,7 +24,7 @@ MODULE_OPTIONS = [
|
|||
]
|
||||
|
||||
|
||||
def _mergetree(src, dst, symlinks=False, ignore=None):
|
||||
def _mergetree(src, dst):
|
||||
"""
|
||||
Akin to shutils.copytree but over existing directories
|
||||
"""
|
||||
|
@ -33,7 +33,10 @@ def _mergetree(src, dst, symlinks=False, ignore=None):
|
|||
d = os.path.join(dst, item)
|
||||
if os.path.isdir(s):
|
||||
log.info("Copying folder {0} to {1}".format(s, d))
|
||||
shutil.copytree(s, d, symlinks, ignore)
|
||||
if os.path.exists(d):
|
||||
_mergetree(s, d)
|
||||
else:
|
||||
shutil.copytree(s, d)
|
||||
else:
|
||||
log.info("Copying file {0} to {1}".format(s, d))
|
||||
shutil.copy2(s, d)
|
||||
|
|
Loading…
Add table
Reference in a new issue