http://www.perlmonks.org?node_id=804546


in reply to Re: Copy preserving attributes
in thread Copy preserving attributes

any solution for extended attributes/ACLs? Or is that too system specific.

Also, how does the efficiency of a single cp system call compare to the code you would have to read and then set timestamp/ownership/permissions internally in perl?

Replies are listed 'Best First'.
Re^3: Copy preserving attributes
by JavaFan (Canon) on Nov 02, 2009 at 19:35 UTC
    Considering that the running time of the 'cp' is most likely to be bound by disk I/O, I wouldn't worry about the overhead of calling 'cp'.

    Specially if you have the need to take care of system specifics (like extended attributes/ACLs), I would prefer calling the systems 'cp' then doing it all yourself. Specially if you don't have access to all the environments the program is supposed to run in.

      I'd have to agree with JavaFan, especially considering those new-fangled attributes. One potential for optimization, if you're not renaming files: you could gather them up by destination directory, and copy multiple files within one command. Not the best solution for error reporting though.