I don't know fsutil, but I think grep is right: you should use File::Find.
However, some more remarks:
- eq compares strings, != compares numbers.
- grep is only for lists; use eq or $str =~ /foo/ to match strings.
- It's always helpful to to check the return values of open and (especially when dealing with command pipes) close
for errors.
- Rather than embedding variables in commands, I prefer to use the several-argument form of open:
open my $handle, '-|', 'fsutil', 'fsinfo', 'drivetype', $letter or die $!;
Hmm, it seems kind of funny that I have two links with the same title. In case you did not notice, one is for the user and one is for the function ;-)