forked from platypush/platypush
[file] Added file.copy
and file.move
actions.
This commit is contained in:
parent
a5426ede58
commit
0bb264792e
1 changed files with 20 additions and 0 deletions
|
@ -154,6 +154,26 @@ class FilePlugin(Plugin):
|
||||||
"""
|
"""
|
||||||
pathlib.Path(self._get_path(file)).rename(self._get_path(name))
|
pathlib.Path(self._get_path(file)).rename(self._get_path(name))
|
||||||
|
|
||||||
|
@action
|
||||||
|
def copy(self, source: str, target: str):
|
||||||
|
"""
|
||||||
|
Copy a file.
|
||||||
|
|
||||||
|
:param source: Source file.
|
||||||
|
:param target: Destination file.
|
||||||
|
"""
|
||||||
|
shutil.copy(self._get_path(source), self._get_path(target))
|
||||||
|
|
||||||
|
@action
|
||||||
|
def move(self, source: str, target: str):
|
||||||
|
"""
|
||||||
|
Move a file.
|
||||||
|
|
||||||
|
:param source: Source file.
|
||||||
|
:param target: Destination file.
|
||||||
|
"""
|
||||||
|
shutil.move(self._get_path(source), self._get_path(target))
|
||||||
|
|
||||||
@action
|
@action
|
||||||
def link(self, file: str, target: str, symbolic=True):
|
def link(self, file: str, target: str, symbolic=True):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue