Add chmod() that uses Python lib functions

This commit is contained in:
Melissa LeBlanc-Williams 2022-11-14 14:03:39 -08:00
parent 7c8bedcb4a
commit 2003329e0e

View file

@ -369,6 +369,14 @@ class Shell:
destination += os.sep + os.path.basename(source) destination += os.sep + os.path.basename(source)
shutil.copy(source, destination) 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): def remove(self, location):
""" """
Remove a file or directory if it exists Remove a file or directory if it exists