rustc/vendor/globwalk
2021-10-08 13:53:48 +01:00
..
examples New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
src New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
tests New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
.cargo-checksum.json New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
appveyor.yml New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
Cargo.lock New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
Cargo.toml New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
LICENSE New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00
README.md New upstream version 1.55.0+dfsg1 2021-10-08 13:53:48 +01:00

GlobWalk

Build Status Build status License crates.io

Recursively find files in a directory using globs.

Based on both walkdir & ignore (❤), this crate inherits many goodies from both, such as limiting search depth and amount of open file descriptors.

Licensed under MIT.

Why not glob

  • The 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 !.
  • glob searches for files in the current working directory, whereas globwalk starts at a specified base-dir.

Usage

To use this crate, add globwalk as a dependency to your project's Cargo.toml:

[dependencies]
globwalk = "0.8.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.