#glob #fnmatch #wildmatch

filenamegen

Shell-style filename generation aka globbing

7 releases

new 0.2.6 May 13, 2024
0.2.5 May 13, 2024
0.2.4 Apr 14, 2020

#161 in Filesystem

Download history 1960/week @ 2024-01-25 1898/week @ 2024-02-01 1133/week @ 2024-02-08 924/week @ 2024-02-15 790/week @ 2024-02-22 717/week @ 2024-02-29 669/week @ 2024-03-07 688/week @ 2024-03-14 942/week @ 2024-03-21 761/week @ 2024-03-28 1115/week @ 2024-04-04 756/week @ 2024-04-11 706/week @ 2024-04-18 802/week @ 2024-04-25 1958/week @ 2024-05-02 1720/week @ 2024-05-09

5,284 downloads per month
Used in 5 crates (via wezterm-ssh)

MIT license

35KB
808 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

~3–11MB
~105K SLoC