mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Add cp helper
This commit is contained in:
parent
f25d202fee
commit
14e37366df
1 changed files with 7 additions and 0 deletions
|
@ -365,3 +365,10 @@ def rm(path, recursive=False, force=False):
|
|||
except OSError as e:
|
||||
if not force:
|
||||
raise MoulinetteError("error_removing", path=path, error=str(e))
|
||||
|
||||
|
||||
def cp(source, dest, recursive=False, **kwargs):
|
||||
if recursive and os.path.isdir(source):
|
||||
return shutil.copytree(source, dest, symlinks=True, **kwargs)
|
||||
else:
|
||||
return shutil.copy2(source, dest, follow_symlinks=False, **kwargs)
|
||||
|
|
Loading…
Add table
Reference in a new issue