[src]

Function glob::glob

pub fn glob(pattern: &str) -> Paths

Return an iterator that produces all the Paths that match the given pattern, which may be absolute or relative to the current working directory.

is method uses the default match options and is equivalent to calling glob_with(pattern, MatchOptions::new()). Use glob_with directly if you want to use non-default match options.

Example

Consider a directory /media/pictures containing only the files kittens.jpg, puppies.jpg and hamsters.gif:

use glob::glob;

for path in glob("/media/pictures/*.jpg") {
    println!("{}", path.display());
}

The above code will print:

/media/pictures/kittens.jpg
/media/pictures/puppies.jpg