Added folder deletion

This commit is contained in:
2022-02-15 23:41:23 -05:00
parent 93ac4ef824
commit 0314bf36af
2 changed files with 21 additions and 8 deletions
+10 -4
View File
@@ -221,10 +221,16 @@ def sync(): # calls sshync to sync changes to the user's server
_deletion_database = None
s_exit()
for _file in _deletion_database:
try:
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError:
print('\nFile does not exist locally.\n')
if _file.endswith('/'):
try:
rmtree(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError:
print('\nFolder does not exist locally.\n')
else:
try:
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError:
print('\nFile does not exist locally.\n')
# set permissions before uploading
system('find ' + directory + ' -type d -exec chmod -R 700 {} +')
system('find ' + directory + ' -type f -exec chmod -R 600 {} +')