Crate globby

Source
Expand description

Globby is a library designed for searching all items in a given directory that match a glob pattern.

§Examples

use globby::{PatternOpts, glob_current_dir};

let pattern = glob_current_dir("**/*.*").unwrap();

for path in pattern {
  println!("{}", path.unwrap().display());
}

This library should work on any platform.

§Comparing to glob

The well-known glob library is more polished and has a lot more options, but also opinionated defaults that differ from this library, such as:

  • The base directory is not yielded in the results
  • Symbolic links are always followed
  • Directories are always yielded before their descendents
  • Alternate groups (matching either one sub-pattern or another) is supported
  • ** matches anything, including files an hidden directories

§Syntax

See Pattern.

Structs§

NoIncomingDir
Pattern
A pattern that can be matched against filesystem paths
PatternOpts
Options for pattern matching
Walker
Walker implementation, yielding filesystem entries that match the provided pattern

Enums§

GlobError
Error occuring during glob execution
PatternMatchResult
Result of a pattern matching against a path

Functions§

glob
Match a pattern against a directory
glob_current_dir
Match a pattern against the current directory
glob_current_dir_with
Match a pattern against the current directory
glob_with
Match a pattern against a directory