cp versus cpio

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
Subject: cp versus cpio
Am 23. Oct, 2003 schw=E4tzte Lynn David Newton so:

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


cp as found on GNU/Linux seems to have stepped up to the same capabilities
as cpio. I haven't really tested it, though, so I might've overlooked some
feature.

The below info is for other environments.

cp doesn't always handle devices or other special files.

cp sometimes copies each instance of a hardlinked file as a new file.

Don't forget -p for cp to preserve timestamps.

Neither preserves directory timestamps. Have to use tar for that (
--atime-preserve ).

> Back when I first used Unix cp did not have a recursive
> flag. In fact, there are probably still versions that
> do not. So for the past 20 years, whenever I've wanted
> to copy a directory tree. I'd simply use find plus
> appropriate flags, maybe filtered and pipe it to
> cpio -pudvm or some variation.
>
> These days when I see other people's scripts, I rarely
> see cpio used. Is it because they don't know about
> cpio, which is trickier to use than cp, or am I just
> hopelessly old-fashioned and behind the times?


Most people I've met have never figured out how to use cpio if they've even
heard of it. If it weren't for my doing time at Mot I'd've probably never
used it either :).

I even got to prefer it over tar for many things, but not being able to
preserve directory timestamps sucks.

ciao,

der.hans
--=20
#  https://www.LuftHans.com/    http://www.AZOTO.org/
#  Stell dir vor, es ist Krieg und keiner geht hin...