in reply to Script to recurse directory down 2 levels and list directors by last modified and size
#!/usr/bin/perl use warnings; use strict; use File::Find::Rule; my $word = shift || 'perl'; # find all the files of a given directory my $directory = shift || '/home/zentara'; my $depth = shift || 3; my $rule1 = File::Find::Rule->new; $rule1->maxdepth($depth); $rule1->file; $rule1->grep(qr/\Q$word\E/); #$rule->name( '*.pm' ); my @files = $rule1->in($directory); print "@files\n";
|
|---|