in reply to Re: cp -p in perl?
in thread cp -p in perl?

It looks like (so far) the best way to do this is to do all your work on a tempfile ( I like File::Temp myself) version of the file you want to copy and then do your chmod and/or chown on the tempfile and then use rename(). This seems to work correctly.

Replies are listed 'Best First'.
Re: cp -p in perl?
by Abigail-II (Bishop) on Apr 21, 2004 at 08:01 UTC
    That doesn't sound like a good idea at all to me. First of all, we're talking about just copying a file, not about any modification. Secondly, using chmod/chown is a lot more work than just using cp. But most importantly, rename will not rename from one device to another.

    Abigail