*BSD News Article 75586


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!vic.news.telstra.net!act.news.telstra.net!psgrain!newsfeed.internetmci.com!hunter.premier.net!news.cais.net!news.abs.net!News1.mcs.net!in-news.erinet.com!bug.rahul.net!rahul.net!a2i!ns2.mainstreet.net!news.roble.com!not-for-mail
From: marquis@roble.com (Roger Marquis)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Best way to copy directory trees
Date: 7 Aug 1996 01:26:18 GMT
Organization: Roble Systems (http://www.roble.com)
Lines: 19
Message-ID: <4u8rbq$5ct@alba.roble.com>
References: <ts-0108961559090001@mac.infodirekt.de> <32017E5B.41C67EA6@eramp.net>
NNTP-Posting-Host: roble.com
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]

syntax (syntax@eramp.net) wrote:
>   tar cf - | (cd destdir; tar xf -)
> ... seem to not exactly preserve directory trees.

Try adding the 'p' flag to the destination tar.  This will 'preserve'
symbolic links.  Sun's man pages also recommend 'B' when tarring across
a network or presumably NFS filesystem:

	cd fromdir; tar cf - . | (cd  todir;  tar xfBp -)

Of course you're still likely to see different numbers from 'du -s
fromdir todir', especially if the filesystems use different block
sizes.

The only files this won't catch are block or character special files
(devices, pipes, etc.) which you'd need to use dump/restore or
cpio/cpio on.

Roger Marquis