add walkdir

This commit is contained in:
2020-01-30 22:23:06 +08:00
parent 3c70fdf3b9
commit ddd07c2166
2 changed files with 23 additions and 0 deletions

10
walkdir/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "walkdir"
version = "0.1.0"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
walkdir = "2.3.1"

13
walkdir/src/main.rs Normal file
View File

@@ -0,0 +1,13 @@
use walkdir::WalkDir;
fn main() {
for entry in WalkDir::new(".") {
match entry {
Ok(en) => {
let is_dir = en.path().is_dir();
println!("-- {} {}", en.path().display(), if is_dir { "[DIR]" } else { "" });
},
Err(er) => println!("[ERROR] {}", er),
}
}
}