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

Re: [MacPerl] changing creation & modification dates



At 12.17 +0200 1999.08.04, Christian Huldt wrote:
>I promised a friend yesterday to fix this, saying that an applescript
>to recurse through his server would take too long.
>
>Now I've searched close to everything (I think), but still lacks the answer...
>
>What am I missing? Is it true that MPPE doesn't treat this?

Look in perlfunc or MPPE under "utime".  Unix has no creation time, and so
this only adjusts modification time.  If you want to change creation time
too, you need the toolbox.

  #!perl -w
  use Mac::Files;
  $file  = 'Bourque:Desktop Folder:a';
  $cinfo = FSpGetCatInfo($file) or die $^E;
  $time = time;

  $cinfo->ioFlCrDat($time);
  $cinfo->ioFlMdDat($time);

  FSpSetCatInfo($file, $cinfo) or die $^E;


Often updating the modification date is enough, though, for my needs.  Here
is a recursive "touch" I wrote.  Save it as a droplet, it updates the
modification time of every file in a directory, recursively.

  #!perl -w
  use File::Find;
  $now = time;
  find(sub { utime($now, $now, $_) or warn "$_: $!" }, @ARGV);

-- 
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