Skip to main content

## recursive_remove

# Function recursive_remove

Source

    pub fn recursive_remove<P: AsRef<Path>>(path: P) -> Result<()>

Expand description

A wrapper around `std::fs::remove_dir_all` that can also be used on non-directory entries, including files and symbolic links.

- This will not produce an error if the target path is not found.
- Like `std::fs::remove_dir_all`, this helper does not traverse symbolic links, will remove symbolic link itself.
- This helper is not robust against races on the underlying filesystem, behavior is unspecified if this helper is called concurrently.
- This helper is not robust against TOCTOU problems.

FIXME: Audit whether this implementation is robust enough to replace bootstrap’s clean `rm_rf`.