#regex #glob #pattern #walk #iterator

globwalk

Glob-matched recursive file system walking

13 releases (7 breaking)

Uses old Rust 2015

0.8.1 Dec 8, 2020
0.8.0 Mar 7, 2020
0.7.3 Mar 5, 2020
0.7.1 May 10, 2019
0.1.0 Feb 20, 2018

#27 in Filesystem

Download history 9493/week @ 2020-12-25 9559/week @ 2021-01-01 14198/week @ 2021-01-08 10484/week @ 2021-01-15 13253/week @ 2021-01-22 14692/week @ 2021-01-29 15976/week @ 2021-02-05 20349/week @ 2021-02-12 19918/week @ 2021-02-19 20822/week @ 2021-02-26 24087/week @ 2021-03-05 36461/week @ 2021-03-12 25837/week @ 2021-03-19 27866/week @ 2021-03-26 22313/week @ 2021-04-02 25307/week @ 2021-04-09

60,218 downloads per month
Used in 188 crates (31 directly)

MIT license

32KB
561 lines

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.

Dependencies

~3MB
~68K SLoC