#directory #file #traversal #windows #walk-dir #time #day

bin+lib winwalk

Walk directories on Windows

3 unstable releases

0.2.2 Dec 20, 2023
0.2.1 Nov 15, 2023
0.2.0 Nov 14, 2023
0.1.0 Sep 20, 2023

#825 in Filesystem

CC0 license

11KB
214 lines

use winwalk::*;

fn main() {
   for drive in drives().into_iter().flatten() {
        println!("Found Drive: {drive}");
    }

    println!();

    for file in walkdir("D:\\Desktop", 1).into_iter().flatten() {
        let pad = if file.is_folder { "  " } else { "--" };
        println!("{pad}{}", file.name);
        println!("  {:?}", file.path);

        println!(
            "  Last Write Time: {:02}/{:02}/{} {:02}:{:02}:{:02}",
            file.last_write.day,
            file.last_write.month,
            file.last_write.year,
            file.last_write.hour,
            file.last_write.minute,
            file.last_write.second,
        );
        println!("  Size: {:?}", file.size);
        println!("  Directory: {:?}", file.is_folder);
        println!();
    }
}

No runtime deps