Heads up: gtar gone from base system

Stephen McKay smckay at internode.on.net
Wed Mar 30 03:39:51 PST 2005


On Tuesday, 29th March 2005, Peter Jeremy wrote:

>Brian missed a pair of parenthenis.  The example should read:
>
>( cd srcdir ; tar cf - . ) | ( cd destdir ; tar xpf - )

Tar is indeed a most excellent program for copying directory trees, since
even in this modern century cp fails to correctly handle hard links.  Sigh.

Still, if you are using tar, be sure to use it correctly:

( cd srcdir && tar cf - . ) | ( cd destdir && tar xpf - )

You don't want it going off in the current directory and mangling things
just because of a little typo in a directory name.

Stephen.

PS If I'm right, the new tar fixes something gtar got wrong: setting
permissions on "." when it is part of the archive, which of course it is
when you copy directories in this way.  This may surprise new users, even
though it is the only sensible result.

PPS Who's for adding a "cp -h" option to copy preserving hard links?


More information about the freebsd-current mailing list