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

Re: [MacPerl] Creation/Modification Date



At 06.32 -0400 1998.08.06, Adrian Howard wrote:
>Use stat to get them:
>
>	($atime,$mtime) = (stat($filename))[8..9]
>
>and utime to set them
>
>	utime $atime, $mtime, $filename;
>
>[sprinkle with error checking code as appropriate]

>From perlport.pod:

=item utime LIST

Only the modification time is updated. (S<Mac OS>, VMS, S<RISC OS>)

Remember, Unix does not have the concept of creation times.

Look into CatInfo stuff:

#!perl -w
use Mac::Files;
use strict;
my($file, $catinfo);

$file = "PowerPudgeII:Desktop Folder:cpantest";
$catinfo = FSpGetCatInfo($file) or die $^E;

print_date($catinfo->ioFlCrDat());
print_date($catinfo->ioFlMdDat());

$catinfo->ioFlCrDat(2 ** 10);
FSpSetCatInfo($file, $catinfo);

print_date($catinfo->ioFlCrDat());
print_date($catinfo->ioFlMdDat());

sub print_date {printf "%s %s\n", scalar localtime $_[0], $_[0]}

__END__

Wed Aug  5 17:39:52 1998 2985183592
Wed Aug  5 17:39:53 1998 2985183593
Fri Jan  1 00:17:04 1904 1024
Wed Aug  5 17:39:53 1998 2985183593


And, sure enough, when I look at the file wiht Get Info, its creation date
is 14.8 years before the last Red Sox World Series championship.

--
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 mac-perl-request@iis.ee.ethz.ch