Hello,
Under unix, a user cannot change ownership of a file to another user and
cannot create a file with another user's ownership.
So, whenever you create a file, you'll be the owner of that file.
Root follows no rules of course.
Hope this helps,,,
Aziz,,,
In article <[EMAIL PROTECTED]>,
"charles" <[EMAIL PROTECTED]> wrote:
> 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]