#glob #fnmatch #wildmatch #filenamegen

filenamegen

Shell-style filename generation aka globbing

5 releases

0.2.4 Apr 14, 2020
0.2.3 Apr 13, 2020
0.2.2 Apr 12, 2020
0.2.1 Apr 11, 2020
0.2.0 Apr 11, 2020

#163 in Filesystem

Download history 1430/week @ 2020-12-24 1090/week @ 2020-12-31 1160/week @ 2021-01-07 1063/week @ 2021-01-14 1490/week @ 2021-01-21 727/week @ 2021-01-28 521/week @ 2021-02-04 442/week @ 2021-02-11 441/week @ 2021-02-18 426/week @ 2021-02-25 510/week @ 2021-03-04 453/week @ 2021-03-11 527/week @ 2021-03-18 528/week @ 2021-03-25 657/week @ 2021-04-01 607/week @ 2021-04-08

4,006 downloads per month
Used in runscript

MIT license

34KB
792 lines

filenamegen

Filename Generation, aka Globbing.

This crate implements shell style file name generation a.k.a.: globbing. The provided globber can expand globs relative to a specified directory (or just the current working directory). filenamegen tries to avoid walking down paths that will never match a glob in order to reduce pressure on the underlying filesystem.

This simple example recursively finds all of the rust source files under the current directory.

use filenamegen::Glob;

fn main() -> anyhow::Result<()> {
  let glob = Glob::new("**/*.rs")?;
  for path in glob.walk(std::env::current_dir()?) {
    println!("{}", path.display());
  }
  Ok(())
}

License: MIT


lib.rs:

Filename Generation, aka Globbing.

This crate implements shell style file name generation a.k.a.: globbing. The provided globber can expand globs relative to a specified directory (or just the current working directory). filenamegen tries to avoid walking down paths that will never match a glob in order to reduce pressure on the underlying filesystem.

This simple example recursively finds all of the rust source files under the current directory.

use filenamegen::Glob;

fn main() -> anyhow::Result<()> {
  let glob = Glob::new("**/*.rs")?;
  for path in glob.walk(std::env::current_dir()?) {
    println!("{}", path.display());
  }
  Ok(())
}

Dependencies

~2MB
~52K SLoC