tar vs cp

Pat Lashley patl+freebsd at volant.org
Wed Oct 1 15:25:34 PDT 2003


--On Wednesday, October 01, 2003 13:22:36 -0400 Chuck Swiger 
<cswiger at mac.com> wrote:

> Jamie wrote:
> [ ... ]
>>     I don't know what the actual rationale is for this. Can anyone
>>     explain why it is oftentimes better to tar something rather than
>> using cp when copying directories and their contents?
>
> tar handles symbolic links properly, whereas cp will "copy through" the
> contents of the link.

Another technique is 'cd /source ; find . -print | cpio -pdmv /dest'.

But none of the built in tools seem to preserve links, flags, and
sparseness.  If you want as close to a true copy as possible, check
out the cpdup port.



-Pat


More information about the freebsd-questions mailing list