On 9/3/07, Shams Fantar <[EMAIL PROTECTED]> wrote:

> Do you have ideas to say "If there is a file which is old likewise of 10
> days" in perl?

There are three timestamps that can mean the age of a file: the mtime,
atime, and ctime. If you want to know how old the data in the file is,
that's the mtime, or modification time. That's usually the one people
mean when they talk about the age of a file, but Perl can also access
the other timestamps.

The usual way to access the mtime is with the -M operator, which
returns the age as measured in days.

  my $filename = "fred";
  warn "The file is at least one day old!"
    if -M $filename > 1;

If you need to delete some file, you can do that with the unlink
operator. Both unlink and -M are documented in the perlfunc manpage.

    http://perldoc.perl.org/perlfunc.html

Does that get you closer to what you need? Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to