#globbing #fnmatch #shell #glob #filenamegen #wildmatch

filenamegen

Shell-style filename generation aka globbing

8 releases

0.2.7 Aug 25, 2024
0.2.6 May 13, 2024
0.2.4 Apr 14, 2020

#220 in Filesystem

Download history 759/week @ 2024-12-20 906/week @ 2024-12-27 1103/week @ 2025-01-03 910/week @ 2025-01-10 959/week @ 2025-01-17 1216/week @ 2025-01-24 811/week @ 2025-01-31 1946/week @ 2025-02-07 809/week @ 2025-02-14 1405/week @ 2025-02-21 1078/week @ 2025-02-28 1495/week @ 2025-03-07 1067/week @ 2025-03-14 743/week @ 2025-03-21 699/week @ 2025-03-28 827/week @ 2025-04-04

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

MIT license

36KB
827 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

Dependencies

~3–10MB
~98K SLoC