#!/usr/bin/perl # setFileInfo # This script sets the Macintosh creator and type codes for files. # The first command-line argument is the desired creator code. # The second command-line argument is the desired type code. # (Creator & type codes are usually 4 characters long) # The subsequent command-line args specify the files to be changed. # # For example, the following would change the files "foo1" and "foo2" # to have creator code "ttxt" and type code "TEXT" (i.e. to be TextEdit files): # setFileInfo "ttxt" "TEXT" foo1 foo2 # See also the 'getFileInfo' script. # # Cameron Hayne (macdev@hayne.net) Oct 2006 use strict; use warnings; use MacPerl; if (scalar(@ARGV) < 3) { die "Usage: setFileInfo creatorCode typeCode file1 [file2 ...]\n"; } my $creatorCode = shift; my $typeCode = shift; my @filePaths = @ARGV; MacPerl::SetFileInfo($creatorCode, $typeCode, @filePaths);