From 2003329e0e61581fb65fb7215e89400fb6edbdf3 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 14 Nov 2022 14:03:39 -0800 Subject: [PATCH] Add chmod() that uses Python lib functions --- adafruit_shell.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/adafruit_shell.py b/adafruit_shell.py index ad26fa7..7de9f33 100644 --- a/adafruit_shell.py +++ b/adafruit_shell.py @@ -369,6 +369,14 @@ class Shell: destination += os.sep + os.path.basename(source) shutil.copy(source, destination) + def chmod(self, location, mode): + """ + Change the permissions of a file or directory + """ + location = self.path(location) + if os.path.exists(location): + os.chmod(location, mode) + def remove(self, location): """ Remove a file or directory if it exists