Thread File::Find - Suche Files
(3 answers)
Opened by Astralkeks at 2012-08-14 17:06 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #!/usr/bin/perl -w use strict; use File::Find; my $result = "result.txt"; my $dir = "C:\\test\\"; my @files=findFiles($result,$dir); print join("\n", @files),"\n"; sub findFiles { my $file=shift; my @dirs=@_; open (my $fh, "<", $file); while(my $regexp=<$fh>) { chomp ($regexp); find(sub { push( @found, $File::Find::name ) if ($_ =~ /$regexp/); }, @dirs); } close $fh; return @found; } |