from pathlib import Path
from shutil import rmtree
for path in Path("/path/to/folder").glob("**/*"):
if path.is_file():
path.unlink()
elif path.is_dir():
rmtree(path)
from: https://stackoverflow.com/questions/185936/how-to-delete-the-contents-of-a-folder
No comments:
Post a Comment