tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cp -n diff



On Thu, May 05, 2011 at 02:45:27PM +0200, Zafer Aydo?an wrote:
 > pax is only in the base system of NetBSD.
 > Its third party for the rest, whereas cp is the same across all.

No, it isn't.

cp is for copying *files*. If you want to copy a whole tree, the only
safe and portable method is to use two tar processes connected with a
pipe. Experienced Unix admins know this. Generally, people who don't
either are beginners or have been confused by Linux's poor
documentation.

Some platforms have made attempts to hoke up their cp so trying to use
it to copy trees is less unsafe; however, most have not. Chasing down
this rathole might or might not be worthwhile in its own right;
however, portraying it as a portability argument is dangerously
misguided.

I'm not saying that tar is a *good* method for copying trees; however,
if you're going to move away from methods that are long-established
standards, you've already got pax. And if you want to do more
elaborate things, there are tools like rsync, unison, and mercurial.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index