0
use File::Find::Rule;

print "Enter threshold size for files to report ";
chomp( $size_req= <>);
$filename= "C:\\Unicorn";
opendir ($filename, '.') or die "Couldn't open directory, $!";
my $subdir = File::Find::Rule->directory
                ->name('C:\\Unicorn\\sub')
                ->prune
                ->discard;
my $rule =  File::Find::Rule->new;
$rule->file;
$rule->size( ">3*1024" );
print "\n";
my @subdirs= $rule->in ($subdir);
print @subdirs;

它仍然显示独角兽文件夹中的子目录。我不知道为什么?

4

1 回答 1

0
use Path::Class::Rule qw();
my $iter = Path::Class::Rule
    ->new
    ->skip_dirs('sub')
    ->file
    ->size('>3M')
    ->iter('C:/Unicorn');
while (my $file = $iter->()) {
    print $file;
}
于 2012-06-26T09:28:42.517 回答