#glob #fnmatch #wildmatch

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

#1207 in Filesystem

Download history 822/week @ 2023-12-08 855/week @ 2023-12-15 817/week @ 2023-12-22 931/week @ 2023-12-29 1115/week @ 2024-01-05 854/week @ 2024-01-12 2680/week @ 2024-01-19 1870/week @ 2024-01-26 1894/week @ 2024-02-02 1062/week @ 2024-02-09 875/week @ 2024-02-16 786/week @ 2024-02-23 706/week @ 2024-03-01 664/week @ 2024-03-08 701/week @ 2024-03-15 852/week @ 2024-03-22

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

MIT license

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

~2.8–4MB
~67K SLoC