#glob #fnmatch #find #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

#149 in Filesystem

Download history 706/week @ 2024-07-02 1403/week @ 2024-07-09 1173/week @ 2024-07-16 811/week @ 2024-07-23 898/week @ 2024-07-30 1006/week @ 2024-08-06 1312/week @ 2024-08-13 1300/week @ 2024-08-20 986/week @ 2024-08-27 929/week @ 2024-09-03 2267/week @ 2024-09-10 1822/week @ 2024-09-17 1227/week @ 2024-09-24 1027/week @ 2024-10-01 1260/week @ 2024-10-08 1477/week @ 2024-10-15

5,266 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


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–10MB
~101K SLoC