On Wed, Oct 01, 2003 at 03:25:27PM -0700, Pat Lashley wrote: > --On Wednesday, October 01, 2003 13:22:36 -0400 Chuck Swiger > <[EMAIL PROTECTED]> 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.
using tar | tar instead of cp -r is usually faster because it makes more efficient use of disk I/O, because reads and writes are queued up at the same time, from the two processes) whereas cp -r reads and writes chunks sequentially (it's actually implemented using mmap'ed memory, which gains some efficiency, but it's still a sequential process because there's only one single-threaded cp running). Kris
pgp00000.pgp
Description: PGP signature