On Wed, 27 Jan 1999 09:58:16 +0000, Jay Bedsole wrote: >For instance, I've got a number of >scripts the mutate text files. The way they do this is >that they read from one file, write to another, delete >the first file, and rename the second file to the first. >Pretty typical; but I add in the following lines to make >the new file adopt the type and creator codes of the old >file. The OS tests let my code run equally well on a unix >box where there is no concept of these codes... > >> if ($^O =~ /MacOS/i) { ($creator,$type) = MacPerl::GetFileInfo($infnam); } >> unlink $infnam; >> rename($outfnam, $infnam); >> if ($^O =~ /MacOS/i) { MacPerl::SetFileInfo($creator,$type, $infnam); } Ah so. Note that you can first make a duplicate of the file, open the duplicate for reading, and write to the original. This will not only preserve file type and creator type, but resource forks as well. I've used that to slightly modify EPS files, while preserving the preview in the resource fork. Bart. ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch