ZHAO, BING wrote: > But, I > figured it might be a good idea to save the file for like a week then > delete it, if I know some kind of function like > "clock"(as wild as it can get..), "date" etc, so after a week or so, > the perl script would delete the file.
The "classic" way to do this kind of thing is to run find(1) from cron periodically: 0 2 * * * find /some/path -type f -mtime +7 -exec rm -f {} \; If you want to do this from Perl, you either need to use cron, or write a long-running "daemon"-type process. cron is the best way to do it. The easiest way to check the age of a file is with Perl's -M operator: unlink $somefile if -M $somefile > 7; ## file is older than 7 days You can also use the find2perl utility (part of File::Find module) to convert the find command above into Perl code. Or, you can use Randal's nifty File::Finder module (http://search.cpan.org/~merlyn/File-Finder-0.53/) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>