tar fs copy

Guy Harris guy at sun.uucp
Tue Oct 22 17:35:42 AEST 1985


> > 	(cd $1; tar cf - .) | (cd $2; tar xf -)
> 
> or (cd $1; find . -print | cpio -o .) | (cd $2; cpio -idu)
> for those without tar.

Or (cd "$1"; find . -depth -print | cpio -pdl "$2"), according to the S5
"cpio" manual page.

> What I really wish our System V people would do is put in the -r flag
> (for recursive) on cp(1), like Berkeley did a long time ago.

It's not too hard to do (I did it a while ago, but don't have the sources
handy).  Both "cp -r" and "tar"/"cpio" have their uses.  "cp -r" is more
convenient, but back-to-back "tar"s and "cpio" will preserve more
information.  (Beware of symbolic links if you do a "cp -r", for instance;
"cp" doesn't know from symlinks.)

	Guy Harris



More information about the Comp.unix.wizards mailing list