[file] Added file.copy and file.move actions.

This commit is contained in:
Fabio Manganiello 2024-08-25 00:10:34 +02:00
parent a5426ede58
commit 0bb264792e
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -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):
""" """