search_dir

A Rust library for finding the first matching item in a directory.

Usage

Add the following to your Cargo.toml:

toml [dependencies] search_dir = "0.1.2"

Example

```rust use std::fs; use std::env; use std::error::Error; use searchdir::search::{ItemType, finditem};

fn main()->Result<(), Box> { //creates directory we want to search fs::createdirall("./some/awesome/really/cool/")?; fs::write("./some/awesome/really/cool/hello.txt", "this is a file")?; let mut currentdir = env::currentdir()?;

//searches for a file called hello.txt let foundpath = finditem(&current_dir, "hello.txt", ItemType::File)?;

println!("{:?}", foundpath); currentdir.push("some"); fs::removedirall(current_dir)?; Ok(()) } ```

License

This project is licensed under Apache License, Version 2.0