| Crates.io | globwalk |
| lib.rs | globwalk |
| version | 0.9.1 |
| created_at | 2018-02-20 19:15:22.386402+00 |
| updated_at | 2024-01-06 20:53:34.390377+00 |
| description | Glob-matched recursive file system walking. |
| homepage | |
| repository | https://github.com/gilnaa/globwalk |
| max_upload_size | |
| id | 52108 |
| size | 47,323 |
Recursively find files in a directory using globs.
This crate is now in a perpetual maintnance mode and new users should probably cosider using glob.
glob crateThis crate was origially written years ago, when glob was a very differet crate,
before it was adopted by the rust-lang org.
Nowadays glob is much better, and overall better maintained,
but there are a few features that it does not seem to have (based on glob 0.3.1):
glob crate does not support having {a,b} in patterns.globwalk can match several glob-patterns at the same time.globwalk supports excluding results with !. (negative patterns)glob searches for files in the current working directory, whereas globwalk starts at a specified base-dir.To use this crate, add globwalk as a dependency to your project's Cargo.toml:
[dependencies]
globwalk = "0.9.1"
The following piece of code recursively find all png, jpg, or gif files:
extern crate globwalk;
use std::fs;
for img in globwalk::glob("*.{png,jpg,gif}").unwrap() {
if let Ok(img) = img {
println!("{:?}", img.path());
}
}
See the documentation for more details.