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

#856 in Filesystem

Download history 514/week @ 2024-10-29 500/week @ 2024-11-05 418/week @ 2024-11-12 364/week @ 2024-11-19 453/week @ 2024-11-26 468/week @ 2024-12-03 611/week @ 2024-12-10 534/week @ 2024-12-17 319/week @ 2024-12-24 373/week @ 2024-12-31 486/week @ 2025-01-07 534/week @ 2025-01-14 632/week @ 2025-01-21 471/week @ 2025-01-28 641/week @ 2025-02-04 778/week @ 2025-02-11

2,590 downloads per month
Used in 17 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

~0.1–6.5MB
~41K SLoC