Perl File::Copy and Apple’s ditto command
You can use Perl’s File::Copy module to move files around your system. The only drawback is that if the files are macbinary and have a resource fork, that portion of the file gets lost. You can use Apples ditto command with –rsrc parameter to move files and maintain the resource.
Following is a perl subroutine I wrote to move files and keep the resource. The script uses both the File::Copy move command and ditto.
sub movefiles{
foreach my $movefile (@filelistarray ) {
system(qq|ditto –rsrc $sourcepath$movefile $destpath$movefile|);
print (LOGFILE “$movefile”.” has gone to the approved folder: “.”$destpath”.”$movefile”.”\n”);
move( “$sourcepath”.”$movefile”, “$backuppath”.”$movefile”) or print (LOGFILE “\tERROR: Cannot move file ” . “$!”);
}
September 13th, 2005 at 11:35 am
What are the parameters for your function?
September 13th, 2005 at 8:24 pm
A list of file names in a directory are contained in @filelistarray. I do a readdir() into @filelistarray.