#directory-tree #directory #file #walk #find-files

walkup

Finds a file by walking up the directory tree

2 stable releases

1.0.1 Aug 6, 2024

#764 in Filesystem

Unlicense OR CC0-1.0

11KB
148 lines

Walk directories up

Crates.io License Crates.io Version Crates.io MSRV Safe Rust dependency status Documentation Downloads

Finds a file by walking up the directory tree until the file is found or root is reached. Name must point to a file, not directory and file must be readable.

How to use

use walkup::walk_up;
// parameters are: start directory, file name
let res = walk_up ( "/usr/src/usr.bin/aucat/", "Makefile.inc" );
if let Some(path) = res {
   println!("Makefile.inc found at {}", path.display());
}

License

This is free and unencumbered software released into the public domain.

This code can be used under terms of CC0 or the Unlicense.

Unlicense logo

No runtime deps