#remove #delete #file #directory #recursive

rm_rf

Force-remove a file/directory and all descendants

15 releases

0.6.2 May 4, 2022
0.6.1 Jan 10, 2021
0.6.0 Feb 12, 2020
0.5.0 Oct 27, 2019
0.2.2 Nov 27, 2018

#526 in Filesystem

Download history 1413/week @ 2023-11-05 1054/week @ 2023-11-12 624/week @ 2023-11-19 859/week @ 2023-11-26 541/week @ 2023-12-03 780/week @ 2023-12-10 492/week @ 2023-12-17 394/week @ 2023-12-24 505/week @ 2023-12-31 951/week @ 2024-01-07 1312/week @ 2024-01-14 1396/week @ 2024-01-21 1268/week @ 2024-01-28 1495/week @ 2024-02-04 1206/week @ 2024-02-11 1190/week @ 2024-02-18

5,247 downloads per month
Used in 16 crates (14 directly)

MIT OR Apache-2.0 OR CC0-1.0

11KB
242 lines

rm -rf CI crates.io

Force-remove a file/directory and all descendants.

In contrast to std::fs::remove_dir_all, it will remove empty directories that lack read access on Linux, and will remove "read-only" files and directories on Windows.

Usage

rm_rf::remove("target")?; // remove, fail if target doesn't exists (this is `rm -rf` behavior)
rm_rf::ensure_removed("target")?; // remove, but ignore if target doesn't exist

Note: to avoid stack overflow for deeply nested directories, this library uses stacker.

Other

Licensed as (at your choice): MIT, Apache2 and CC0 ("public domain").

Dependencies

~100–480KB