in reply to Checking Age of Files

What have you tried? Have you written any code? Effort is appreciated - see How (Not) To Ask A Question.

You can check how old a file is using the -M function. You can get the contents of your directory using the set opendir, readdir, and closedir, where there is an example at readdir.

There are large number of email modules freely available on CPAN - one useful search term would be email. Email::Sender::Simple, for example, may do what you want.

Update: Note toolic's comment below regarding units. -M does return in units of days, but in decimal days. A simple conversion factor of 24 is all that is required.

Replies are listed 'Best First'.
Re^2: Checking Age of Files
by toolic (Bishop) on Jan 25, 2010 at 17:46 UTC
    You can check how old a file is using the -M function.
    The OP wants hours, but the doc says (emphasis is mine)
    # -M Script start time minus file modification time, in days.
    Probably a solution using stat and one of the CPAN Date/Time modules will be needed.
      It returns a real (as opposed to integer) number of days, so -M * 24 > 2 should do fine for the OP if he's ok with being off by an hour around DST changes.
        That is an extremely useful piece of information which is not at all obvious to a (below-)average Perl user, such as myself. I interpreted "days" to mean that I should not expect it to resolve fractional days, or less than a day. But, it sounds like the actual resolution might be seconds.

        Is this explicitly mentioned anywhere in the documentation? If not, I think it would be a valuable addition to the -M doc. It would be great if you transferred your knowledge to a patch.