in reply to How do I find and delete files based on age?
untested Perl one liner:
Note: this is a deliberately simplistic example. To optimise it to avoid shelling out (using either File::Find or putting the glob in a recursive subroutine) would require more Perl experience than OP suggests.perl -e 'system "rm -rf $_" if ( -M $_ > 14 ) for ( glob "/var/backups +/repository/DATE_*" );'
Update: Newbies will particularly benefit from Learning Perl, Third Edition - Making Easy Things Easy and Hard Things Possible By Randal L. Schwartz & Tom Phoenix.
-M
Free your mind
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How do I find and delete files based on age?
by graq (Curate) on Feb 26, 2007 at 16:28 UTC | |
by Moron (Curate) on Feb 26, 2007 at 16:36 UTC | |
Re^2: How do I find and delete files based on age?
by exussum0 (Vicar) on Feb 26, 2007 at 17:32 UTC | |
by TGI (Parson) on Feb 26, 2007 at 20:51 UTC | |
by Moron (Curate) on Feb 26, 2007 at 17:47 UTC |
In Section
Seekers of Perl Wisdom