The below example runs and simply prints the file names of files inside the c:temp folder, you will need to add the behaviour you require on the “print” line:
Command line call:
perl.exe c:find.pl c:temp
Script
use strict;
use File::Find;
my ($area) = @ARGV;
my(@files, $file);
find(&wanted, $area);
foreach $file(@files){
if (-f $file){
print "File: $filen";
}
}
sub wanted {
push @files, $File::Find::name;
return @files;
}
Result
File: c:temp/find.txt
File: c:temp/find2.txt
File: c:temp/find3.txt
File: c:temp/find4.txt
File: c:temp/regfind.exe