Function winsafe::path::dir_list

source ·
pub fn dir_list<'a>(
    dir_path: &'a str,
    filter: Option<&'a str>
) -> impl Iterator<Item = SysResult<String>> + 'a
Available on crate feature kernel only.
Expand description

Returns an iterator over the files and folders within a directory. Optionally, a wildcard can be specified to filter files by name.

This is a high-level abstraction over HFINDFILE iteration functions.

§Examples

Listing all text files in a directory:

use winsafe::{self as w, prelude::*};

for file_path in w::path::dir_list("C:\\temp", Some("*.txt")) {
    let file_path = file_path?;
    println!("{}", file_path);
}