How to use walkdir crate in Rust directory traversal

Traverse directories recursively in Rust using the walkdir crate to find and process files matching specific criteria.

Use walkdir::WalkDir::new() to create an iterator over files and directories, then chain .into_iter() and .map() to process each entry.

use walkdir::WalkDir;

for entry in WalkDir::new("src")
    .min_depth(1)
    .into_iter()
    .filter_map(|e| e.ok())
{
    if entry.path().extension().map_or(false, |ext| ext == "md") {
        println!("Found: {}", entry.path().display());
    }
}

This code traverses the src directory, skips the root, and prints paths of .md files, matching the logic in lfp.rs.