mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-06 09:07:13 -04:00
Added folder deletion
This commit is contained in:
@@ -221,6 +221,12 @@ def sync(): # calls sshync to sync changes to the user's server
|
|||||||
_deletion_database = None
|
_deletion_database = None
|
||||||
s_exit()
|
s_exit()
|
||||||
for _file in _deletion_database:
|
for _file in _deletion_database:
|
||||||
|
if _file.endswith('/'):
|
||||||
|
try:
|
||||||
|
rmtree(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\nFolder does not exist locally.\n')
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
|
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
@@ -4,11 +4,18 @@
|
|||||||
|
|
||||||
from os import remove, listdir
|
from os import remove, listdir
|
||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
|
from shutil import rmtree
|
||||||
|
|
||||||
|
|
||||||
# utility functions
|
# utility functions
|
||||||
|
|
||||||
def delete(_file_path):
|
def delete(_file_path):
|
||||||
|
if _file_path.endswith('/'):
|
||||||
|
try:
|
||||||
|
rmtree(f"{expanduser('~/.password-pasture/')}{_file_path}")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('\nFolder does not exist remotely.')
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
remove(f"{expanduser('~/.password-pasture/')}{_file_path}.gpg")
|
remove(f"{expanduser('~/.password-pasture/')}{_file_path}.gpg")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
Reference in New Issue
Block a user