A Rust library for finding the first matching item in a directory.
Add the following to your Cargo.toml
:
toml
[dependencies]
search_dir = "0.1.2"
```rust use std::fs; use std::env; use std::error::Error; use searchdir::search::{ItemType, finditem};
fn main()->Result<(), Box
//searches for a file called hello.txt
let foundpath = finditem(¤t_dir, "hello.txt", ItemType::File)?;
println!("{:?}", foundpath); currentdir.push("some"); fs::removedirall(current_dir)?; Ok(()) } ```
This project is licensed under Apache License, Version 2.0