separate handling of single files
This commit is contained in:
parent
c92c93458c
commit
620945da3c
1 changed files with 5 additions and 3 deletions
|
@ -159,10 +159,12 @@ def secure_delete(path: str):
|
||||||
|
|
||||||
for root, dirs, files in os.walk(name, topdown=False):
|
for root, dirs, files in os.walk(name, topdown=False):
|
||||||
for name in files:
|
for name in files:
|
||||||
p = Path (os.path.join(root, name))
|
p = Path(os.path.join(root, name))
|
||||||
p.chmod(stat.S_IWRITE)
|
p.chmod(stat.S_IWRITE)
|
||||||
|
if os.path.isdir(name):
|
||||||
shutil.rmtree(name)
|
shutil.rmtree(name)
|
||||||
|
else:
|
||||||
|
os.unlink(name)
|
||||||
|
|
||||||
shutil.rmtree(path, onerror=del_rw)
|
shutil.rmtree(path, onerror=del_rw)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue