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

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