3 releases
0.1.2 | Jan 19, 2025 |
---|---|
0.1.1 | Jan 19, 2025 |
0.1.0 | Jan 19, 2025 |
#855 in Filesystem
296 downloads per month
5KB
dir_rec.rs
You just copy dir_rec.rs
file to your project and use it.
example.rs
use std::env;
use std::process::ExitCode;
use dir_rec::DirRec;
fn main() -> ExitCode {
let args = env::args().collect::<Vec::<_>>();
if args.len() < 2 {
eprintln!("usage: {program} <directory to traverse recursively>", program = args[0]);
return ExitCode::FAILURE
}
let ref dir_path = args[1];
let dir = DirRec::new(dir_path);
for file_path in dir.into_iter() {
println!("{entry}", entry = file_path.display());
}
ExitCode::SUCCESS
}