in reply to Re: search folder and delete certain files with perl
in thread search folder and delete certain files with perl
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: search folder and delete certain files with perl
by TJPride (Pilgrim) on Dec 07, 2011 at 21:33 UTC | |
by CountZero (Bishop) on Dec 07, 2011 at 21:42 UTC | |
by TJPride (Pilgrim) on Dec 07, 2011 at 22:08 UTC | |
by Your Mother (Archbishop) on Dec 08, 2011 at 14:11 UTC |