Iterator that recursively scans and filters files from a directory.
Start using this library by running the following command in your cargo project directory.
cargo add dir-iteratoruse dir_iterator::*
fn main() {
// create a new iterator starting in the current directory
DirIterator::new()
// you will get this error if path was not found
.expect("path not found")
// while processing recursive dive multiple file system errors may occur.
// flatten sorts them out
.flatten()
// print each file name
.for_each(|e| println!("{:?}",e.file_name()));
}use dir_iterator::*
fn main() {
DirIterator::new()
.expect("path not found")
.flatten()
// filter all files which have extension `txt`
.filter(wildcard("*.txt"))
.for_each(|e| println!("{:?}",e.file_name()));
}