in reply to del files that is 7 days or older
First, let's format things a little so we can see more
clearly what you are sharing with us. If you put your code
between <code>...</code> tags, it will keep its
alignment. Here's your code again:
#!/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 $_"); } };
|
---|
In Section
Seekers of Perl Wisdom