cp versus cpio

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Buettner
Date:  
Subject: cp versus cpio
On Oct 23, 10:02pm, Lynn David Newton wrote:

> Does anyonw have any particular insight into the
> advangages/disadvantages of using cp -R versus cpio?


I have heard it said that cpio does a better job of preserving file
attributes. I almost always use "cp -a" (which is the same as
"cp --archive") when I need to make recursive copies. The problem
with -R alone is that it doesn't preserve the file's attributes.

The only drawback (that I know of) with "cp -a" is that the -a flag
isn't found in all versions of "cp". So, if you're writing a script,
and want it to be portable, you'll need to use either cpio or tar.

If you find yourself using a version of "cp" which doesn't support
the -a flag, "cp -R -p" usually does a pretty good job of making
recursive copies.

Kevin