in reply to Re: Checking Age of Files
in thread Checking Age of Files

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.

Replies are listed 'Best First'.
Re^3: Checking Age of Files
by ikegami (Patriarch) on Jan 25, 2010 at 17:49 UTC
    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.