#file #directory #filesystem

remove_empty_subdirs

Recursively remove empty sub-directories

2 releases

Uses old Rust 2015

0.1.1 Sep 14, 2018
0.1.0 Sep 2, 2018

#213 in Filesystem

40 downloads per month
Used in 2 crates

MIT/Apache

8KB
62 lines

remove_empty_subdirs

Recursively remove empty sub-directories.

Note:

  • Hidden directories which start with ".", e.g. ".git" are ignored.
  • Permission denied directories and their sub-directories are ignored.

Usage

Library

Add the library as a dependency to your project by inserting

remove_empty_subdirs = "0.1.0"

into the [dependencies] section of your Cargo.toml file.

Then use it in the source code of your project. For example:

extern crate remove_empty_subdirs;

use std::path::Path;

use remove_empty_subdirs::remove_empty_subdirs;

fn main() {
    let path = Path::new("test_dir");
    remove_empty_subdirs(path).unwrap();
}

Executable

First, build the executable in examples/ directory:

cargo build --release --examples

Then copy the built executable target/release/examples/remove_empty_subdirs to anywhere you like.

Run the executable:

/path/to/remove_empty_subdirs --help

to get the help for usage.

License

This project is licensed under either of

at your option.

No runtime deps