[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] File Modification Date?



At 11.59 -0400 1999.05.23, Chilton Webb wrote:
>What's the best way to get the file modification date of a file?
>
>Can this be done cross-platform, or is it platform-specific?

The best way is to use the built-in perl function, but it may not work on a
given platform.  It does work on Unix and Mac.  See perlfunc for stat(),
and the field for mtime.  See also perlport (doesn't come with MacPerl now,
comes with perl5.005, and is on my site) under stat() for more info on how
that function differs on various platforms.

You cna also use -M, which is like stat's mtime, but mtime is seconds since
epoch, and -M is age in days.  So these both give the same result:

  print time - ((-M ":MacPerl") * 86400);
  print ((stat(":MacPerl"))[9]);

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org