#glob #directory #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

#180 in Filesystem

Download history 1123/week @ 2024-11-17 1000/week @ 2024-11-24 1258/week @ 2024-12-01 1158/week @ 2024-12-08 922/week @ 2024-12-15 774/week @ 2024-12-22 1040/week @ 2024-12-29 952/week @ 2025-01-05 915/week @ 2025-01-12 1079/week @ 2025-01-19 1065/week @ 2025-01-26 1021/week @ 2025-02-02 1811/week @ 2025-02-09 994/week @ 2025-02-16 1265/week @ 2025-02-23 1096/week @ 2025-03-02

5,364 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
~97K SLoC