At 09:57 -0800 2002.02.25, Andrew O. Mellinger wrote:
> Okay, it seems that File::Copy doesn't work on Directories. I'm
>sure somebody has a routine in the standard packages by now (5.004 or
>cpan bundle) that should work like cp/duplicate in that it is smart
>enough to work on files or folders/directories. (I don't really
>want to roll my own when I'm sure someone has implemented this.)
>
> Does anyone know offhand what the name of this would be?
>
> Especially since Bundles under OSX may *look* like files but are
>indeed directories.
I normally just roll my own. It's quite simple code, once you know what
you're doing, and really only a handful of lines. Something like:
#!perl -w
use strict;
use File::Copy;
use File::Find;
use File::Path;
my $origpath = 'Bourque:Prog:MacPerl �:lib:auto:';
my $destpath = 'Bourque:Desktop Folder:auto:';
find(\&mycopy, $origpath);
sub mycopy {
my($file) = $File::Find::name;
(my $dest = $file) =~ s/^\Q$origpath/$destpath/;
if (-d $file) {
mkpath $dest;
} elsif (-f $file) {
copy $file, $dest;
}
}
__END__
--
Chris Nandor [EMAIL PROTECTED] http://pudge.net/
Open Source Development Network [EMAIL PROTECTED] http://osdn.com/