I am using File::Copy and I think I am either misreading the CPAN doc or
missing
something in my code. When I am copying files, ownership and permissions
do not
remain intact, but rather take on the ownership and permissions of the
user running the
script.
The docs talk about syscopy but since I am running the code on a unix
variant (linux) I had
thought that copy would suffice.
The code:
#!/usr/bin/perl -w
use strict;
use File::Copy;
my $from = "/root/yim";
my $to = "/root/perl/yim";
if ( -d $from ) {
mkdir "$to";
}
opendir(DIR,"$from");
my @contents = readdir(DIR);
for my $i(@contents) {
if ( -f "$from/$i" ) {
copy("$from/$i","$to/$i");
}
}
close(DIR);
print @contents;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]