#utility #directory-tree #windows #remove-dir

bin+lib remove_dir_all

A safe, reliable implementation of remove_dir_all for Windows

13 unstable releases

0.8.2 Mar 24, 2023
0.7.0 Mar 5, 2021
0.6.1 Oct 16, 2020
0.5.3 Jun 12, 2020
0.1.0 Mar 29, 2017

#25 in Filesystem

Download history 214477/week @ 2024-01-03 244164/week @ 2024-01-10 262869/week @ 2024-01-17 226577/week @ 2024-01-24 244938/week @ 2024-01-31 244889/week @ 2024-02-07 244682/week @ 2024-02-14 291324/week @ 2024-02-21 269482/week @ 2024-02-28 268923/week @ 2024-03-06 252302/week @ 2024-03-13 264166/week @ 2024-03-20 272183/week @ 2024-03-27 269139/week @ 2024-04-03 272436/week @ 2024-04-10 229137/week @ 2024-04-17

1,093,532 downloads per month
Used in 1,674 crates (63 directly)

MIT/Apache

31KB
417 lines

remove_dir_all

Latest Version Docs License

Description

Reliable and fast directory removal functions.

  • remove_dir_all - on non-Windows this is a re-export of std::fs::remove_dir_all. For Windows an implementation that handles the locking of directories that occurs when deleting directory trees rapidly.

  • remove_dir_contents - as for remove_dir_all but does not delete the supplied root directory.

  • ensure_empty_dir - as for remove_dir_contents but will create the directory if it does not exist.

extern crate remove_dir_all;

use remove_dir_all::*;

fn main() {
    remove_dir_all("./temp/").unwrap();
    remove_dir_contents("./cache/").unwrap();
}

Minimum Rust Version

The minimum rust version for remove_dir_all is the latest stable release, and the minimum version may be bumped through patch releases. You can pin to a specific version by setting by add = to your version (e.g. =0.6.0), or commiting a Cargo.lock file to your project.

Dependencies

~2–12MB
~127K SLoC