Remove the path contents recursively, even if some elements are read-only.
(path: Path)
| 159 | |
| 160 | |
| 161 | def rm_rf(path: Path) -> None: |
| 162 | """Remove the path contents recursively, even if some elements |
| 163 | are read-only.""" |
| 164 | path = ensure_extended_length_path(path) |
| 165 | onerror = partial(on_rm_rf_error, start_path=path) |
| 166 | if sys.version_info >= (3, 12): |
| 167 | shutil.rmtree(str(path), onexc=onerror) |
| 168 | else: |
| 169 | shutil.rmtree(str(path), onerror=onerror) |
| 170 | |
| 171 | |
| 172 | def find_prefixed(root: Path, prefix: str) -> Iterator[os.DirEntry[str]]: |