in reply to Delete Files

In addition to the other comments here, you can save yourself one stat per file if you use the cached "_" file, like this:
for my $filename (@files) { my $filepath = "$dir$filename"; stat($filepath); if (-f _ and -M _ > $daysToPurge) { print LOGF "$filepath will be purged\n"; unlink $filepath or print ERRLOG "Can't remove $filepath: $!"; } }

Replies are listed 'Best First'.
Re: Re: Delete Files
by windy (Initiate) on Feb 07, 2003 at 02:05 UTC
    Thank you all for your response. I used your information and it works great. I also changed the naming convention as it was pointed out it would not sort well.