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

Re: [MacPerl] mac file modification date



You wrote to the MacPerl list on Sat, 25 Oct 97 23:32:48 EDT --

>Hello.  Is there a way to find out the modification date of a mac file
>from within MacPERL?

Yes -- try this:

#!perl
use Mac::Files;

$file ="full:path:to:file";
$cat = FSpGetCatInfo($file);

$crt = $cat->ioFlCrDat;
$mdt = $cat->ioFlMdDat;

print scalar gmtime($crt), "\n"; #creation date
print scalar gmtime($mdt), "\n"; #modification date

This assumes you have MacPerl 514r2 or 514r4. If you have 513r2 or earlier
the syntax is different. In that case it might be better to upgrade rather
than do battle with the old syntax.

I suggest you look at 'lib:Mac:Files.pm' with "Shuck" and also at Files.xs
(with a text reader) for details of other information obtainable from the
file catalog block.

Hope this helps.

Alan Fry.



>- peter



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch