Stephen McKay wrote: >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. > > I find "find -depth |cpio -pdmuv" is better because it has the option of being run as: find -depth |cpio -pdmv which will only update new files . this is excelent if you stop it half way through for some reason and want to continue the copy.. good if you want to keep one tree in sync with another. also find -depth |cpio -pdlmuv is good if you want a 'linked' copy of a directory where all the files are hardlinks of the original. >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? >_______________________________________________ >freebsd-current_at_freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-current >To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org" > >Received on Wed Mar 30 2005 - 17:55:02 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:30 UTC