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

Re: [MacPerl] Duplicating a file on a mac?



At 10:11 -0700 1999.08.31, Rob Sirota wrote:
>I just noticed that my script for duplicating a file has problems it
>a file has a resource fork too. If I call:
>
>	FSpFileCopy($src, $dPath, $dsFile, 1);
>
>only the datafork gets created in the new file. Is there a file copy
>that will take a file that has both a resource and data fork on the
>mac and make a new file?

FSpFileCopy copies resource forks.

  use Mac::MoreFiles;
  chdir('Bourque:Desktop Folder:') or die $!;
  FSpFileCopy('a', ':', 'b', '') or die $^E;
  # create Bourque:Desktop Folder:b, including resource fork

But you might be better off using File::Copy.

  use File::Copy;
  chdir('Bourque:Desktop Folder:') or die $!;
  copy('a', 'b') or die $^E;

File::Copy includes FSpFileCopy() so the resource fork and data fork are
properly copied.

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