Add counter when is_file()

master
Benoît 2018-05-01 22:52:30 +02:00
parent 0351adc51f
commit 4cb09cd6a9
1 changed files with 10 additions and 7 deletions

View File

@ -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::<Sha256, _>(&mut file,
&format!("{}", entry.path().display()));
&format!("[{}] - {}",
i,
entry.path().display()));
i = i+1;
}
}
}