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};

let pattern = glob("**/*.*").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§

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
WindowsDrive
A valid Windows drive

Enums§

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

Functions§

glob
Match a pattern against the current directory
glob_in
Match a pattern against a provided directory
glob_in_with
Match a pattern against a provided directory
glob_with
Match a pattern against the current directory
normalize_path
Normalize a path