From 78fedaa97d0714122e378afdf895cd294502dd04 Mon Sep 17 00:00:00 2001 From: OusmBlueNinja <89956790+OusmBlueNinja@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:09:31 -0500 Subject: [PATCH] Add files via upload --- packages/filemanip.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/filemanip.py diff --git a/packages/filemanip.py b/packages/filemanip.py new file mode 100644 index 0000000..0774774 --- /dev/null +++ b/packages/filemanip.py @@ -0,0 +1,34 @@ +# ["filemanip", "packages.filemanip", ["mv", "cp"]] +import os +import shutil + +def mv(command: list): + if len(command) != 2: + print("Usage: mv [source] [destination]") + return + + source = command[0] + destination = command[1] + + try: + shutil.move(source, destination) + print(f"Moved '{source}' to '{destination}'") + except Exception as e: + print(f"Error moving '{source}' to '{destination}': {str(e)}") + +def cp(command: list): + if len(command) != 2: + print("Usage: cp [source] [destination]") + return + + source = command[0] + destination = command[1] + + try: + shutil.copy2(source, destination) + print(f"Copied '{source}' to '{destination}'") + except Exception as e: + print(f"Error copying '{source}' to '{destination}': {str(e)}") + +# made by OusmBlueNinja +