in reply to
Re: search folder and delete certain files with perl
in thread search folder and delete certain files with perl
Because it is so much more compact:
use Modern::Perl;
use File::Find::Rule;
my $directory = '/var/opt/xim/syslogs/';
my $age = time - 12*60*60;
unlink for File::Find::Rule->file()
->name('Syslogd*')
->mtime("<$age")
->maxdepth( 1 )
->in($directory);
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James