skyeweave/atlasimagecomposer/utils/filesystem.py
Firq fbda98805f
All checks were successful
/ lint-and-typing (push) Successful in 4m41s
/ build-artifacts (push) Successful in 15s
/ publish-artifacts (push) Successful in 1m2s
/ release (push) Successful in 59s
/ mypy (push) Successful in 17s
/ pylint (push) Successful in 12s
Release Candidate 1 for the people
2024-10-05 14:01:50 +02:00

16 lines
348 B
Python

import pathlib
def rmdir(directory: pathlib.Path):
"""
Recursively deletes all files and folders in a given directory
From: https://stackoverflow.com/a/49782093 (thanks mitch)
"""
for item in directory.iterdir():
if item.is_dir():
rmdir(item)
else:
item.unlink()
directory.rmdir()