#!C:\Perl\bin\perl.exe use strict; use File::Find; use File::Slurp; use Time::Local; print "\nRunning find-slurp_search-within.pl... \n\n"; my $root = "C:/"; print "changing to $root\n"; chdir $root; my $no_switch=0; my $no_files=0; my @log = (); my $dir; # find (\&Wanted, "department", "managers", "mybranch", "mycity", "myinfo", "resources"); find (\&Wanted, "working"); #directories - comman delimited sub Wanted { print "*Processing: $root$File::Find::name \n"; if ($_ =~ /\.htm(l)?$/i) { my $file_slurp = read_file("$root$File::Find::name"); if ($file_slurp =~ m/($root$File::Find::name") or die "ERROR: Can't open $root$File::Find::name"; print FILE "$file_slurp"; close (FILE); print "file overwritten\n"; push @log,"$root$File::Find::name \n\n"; $no_switch++; } $no_files++; } #end if matches filetype else { print "file type not processed\n\n"; } #add $_ if you want to see URL of file not processed. } # end sub