Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!psgrain!iafrica.com!uct.ac.za!und.ac.za!peacenjoy.mikom.csir.co.za!news.uoregon.edu!csulb.edu!info.ucla.edu!agate!howland.erols.net!vixen.cso.uiuc.edu!chaos.crhc.uiuc.edu!news2.acs.oakland.edu!newsfeed.concentric.net!news-master!news
From: dantso@cris.com (Daniel Ts'o)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Best way to copy directory trees
Date: Sun, 25 Aug 96 22:42:30 GMT
Organization: The Rockefeller University
Lines: 40
Message-ID: <4vqhm8$ol7@herald.concentric.net>
References: <ts-0108961559090001@mac.infodirekt.de> <gergDvH52n.6K9@netcom.com>
NNTP-Posting-Host: crc12.cris.com
X-Newsreader: News Xpress Version 1.0 Beta #4
In article <gergDvH52n.6K9@netcom.com>, gerg@netcom.com (Greg
Andrews) wrote:
:ts@infodirekt.de (Thomas Schreiber) writes:
:>I have installed a second drive on my FreeBSD 2.1 machine
:>and want to move a few file systems around now.
:>
:>What is the best way to copy directory trees with preserving
:>access dates, permissions, links and so on?
:I've always used:
:
: cd /path/to/old/dir
: find . -depth -print | cpio -pdmv /path/to/new/dir
yes, I usually use cpio like above:
find dir0 -print | cpio -pldumv dir1
It maintains links, times, owners, etc. Smarter CPIO's can
maintain
device nodes, named pipes, etc. An advantage over the double tar
method is
that the data doesn't have to travel over a pipe, only filenames
are travel
over the pipe in the example above.
However if it is a cross-machine copy, then I use tar,
since you have
to move the data across the two machines in some way. Much faster
than NFS:
tar cf - . | rsh desthost "cd newdir; tar xf -"
Cheers,
Dan Ts'o 212-327-7671
Dept. of Neurobiology FAX: 212-327-7671
The Rockefeller University
1230 York Ave. Box 138 dantso@cris.com
New York, NY 10021 dan@dna.rockefeller.edu