Function glob::glob[src]

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.

This 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:

extern crate glob; fn main() { use glob::glob; for path in glob("/media/pictures/*.jpg") { println!("{}", path.display()); } }
use glob::glob;

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

The above code will print:

fn main() { /media/pictures/kittens.jpg /media/pictures/puppies.jpg }
/media/pictures/kittens.jpg
/media/pictures/puppies.jpg