globwalker

Crates.ioglobwalker
lib.rsglobwalker
version0.9.0
sourcesrc
created_at2023-10-05 00:27:49.648134
updated_at2023-10-05 00:27:49.648134
descriptionGlob-matched recursive file system walking. Fork of 'globwalk'
homepage
repositoryhttps://github.com/foresterre/globwalker
max_upload_size
id993471
size50,686
Martijn Gribnau (foresterre)

documentation

README

GlobWalker

Fork of GlobWalk

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.
  • globwalker can match several glob-patterns at the same time.
  • globwalker supports excluding results with !.
  • glob searches for files in the current working directory, whereas globwalker starts at a specified base-dir.

Usage

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

[dependencies]
globwalker = "0.9.0"

The following piece of code recursively find all png, jpg, or gif files:

extern crate globwalker;

use std::fs;

for img in globwalker::glob("*.{png,jpg,gif}").unwrap() {
    if let Ok(img) = img {
        println!("{:?}", img);
    }
}

See the documentation for more details.

Commit count: 99

cargo fmt