Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm try to write a script that deletes files which are 7 days old (or older)
Can anyone help?#!/usr/bin/perl chdir('/home/archive/logs/old'); @FileNum = system("ls -t -al") ; chomp($month = 'date +"%b" --date "7 day ago"'); chomp($date = 'date +"%d" --date "7 day ago"'); foreach (@FileNum) { if /how do I compar the date?? here { system(" rm $_"); } };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: del files that is 7 days or older
by oakley (Scribe) on Feb 15, 2001 at 00:23 UTC | |
(dkubb) Re: (2) del files that is 7 days or older
by dkubb (Deacon) on Feb 15, 2001 at 06:14 UTC | |
Re: del files that is 7 days or older
by dvergin (Monsignor) on Feb 15, 2001 at 02:37 UTC | |
by ariels (Curate) on Jun 30, 2002 at 06:52 UTC | |
Re: del files that is 7 days or older
by dvergin (Monsignor) on Feb 15, 2001 at 00:21 UTC |
Back to
Seekers of Perl Wisdom