1
0
Fork 0

separate handling of single files

This commit is contained in:
Christian Kühnel 2020-04-16 13:52:08 +02:00
parent c92c93458c
commit 620945da3c

View file

@ -159,10 +159,12 @@ def secure_delete(path: str):
for root, dirs, files in os.walk(name, topdown=False):
for name in files:
p = Path (os.path.join(root, name))
p = Path(os.path.join(root, name))
p.chmod(stat.S_IWRITE)
shutil.rmtree(name)
if os.path.isdir(name):
shutil.rmtree(name)
else:
os.unlink(name)
shutil.rmtree(path, onerror=del_rw)