Recursively delete directories on Windows without race conditions
- Dominant language
- Haskell
- Stars
- 65
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Description
[Niall Douglas' "Racing the File System" at *CppCon*](https://youtu.be/uhRWMGBjlO8?t=621) actually outlines a deletion algorithm that works correctly on Windows. It does not require retries.
The gist of it:
- Deletion is effectively asynchronous on Windows.
- If deleting recursively, you want to rename the item you're deleting out of the directory you're deleting first, then delete it.
This provides an alternative solution to the issue described in #96 and #108.
### Alternative
It seems there's yet another way to do this using Windows 10 V1607's POSIX-compatible API:
SetFileInformationByHandle(FILE_DISPOSITION_INFO_EX { FILE_DISPOSITION_DELETE | FILE_DISPOSITION_POSIX_SEMANTICS })
But this is limited to NTFS.
https://stackoverflow.com/a/50234974
Contributor guide
Assessment
This issue has not been assessed yet.