From 4cb09cd6a921e65a9b95125d9a8b3e730df66669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Mauduit?= Date: Tue, 1 May 2018 22:52:30 +0200 Subject: [PATCH] Add counter when is_file() --- src/main.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 41aa92e..53d484d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -165,19 +165,22 @@ fn main() { } // Output - for entry in WalkDir::new(&args.output).into_iter().filter_map(|e| e.ok()) { - //println!("[O] {}", entry.path().display()); - + let mut i = 0; + for entry in WalkDir::new(&args.output) + .into_iter() + .filter_map(|e| e.ok()) + { // symlink_metadata does not follow symlink :-] let metadata = fs::symlink_metadata(entry.path()).unwrap(); let ft = metadata.file_type(); - + if ft.is_file() { - //println!("[I] Name: {}", entry.path().display()); - if let Ok(mut file) = fs::File::open(&entry.path()) { process::(&mut file, - &format!("{}", entry.path().display())); + &format!("[{}] - {}", + i, + entry.path().display())); + i = i+1; } } }