in reply to Script to recurse directory down 2 levels and list directors by last modified and size

You might find File::Find::Rule easy for depth control:
#!/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";

I'm not really a human, but I play one on earth Remember How Lucky You Are
  • Comment on Re: Script to recurse directory down 2 levels and list directors by last modified and size
  • Download Code