This should print out all the filenames with a .h or .c extension on Win32 in a specified subdirectory. Naturally, you would want to tweak it to suit your needs, but it finds the extensions quite nicely.
use Win32::Process;
print "Enter the subdirectory you'd like to parse: ";
$path = <STDIN>;
chomp( $path );
$prefix = "C:\\Projects\\Source\\";
$path = "$prefix$path";
$path = "." unless $path;
opendir( DIR, $path )
or die "Can't open $path: $!";
while ( $entry = readdir( DIR ) ) {
$type = ( -d "$path\\$entry" ) ? "dir" : "file"; # $path is crucia
+l!
if( $entry =~ /\.h|\.c$/ ){
print "$entry\n";
}
}
closedir( DIR );