*BSD News Article 75248


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!paladin.american.edu!zombie.ncsc.mil!nntp.coast.net!fu-berlin.de!news.dfn.de!news.dkrz.de!news.rrz.uni-hamburg.de!news.Hanse.DE!wavehh.hanse.de!cracauer
From: cracauer@wavehh.hanse.de (Martin Cracauer)
Subject: Re: Best way to copy directory trees
Message-ID: <1996Aug1.202257.4419@wavehh.hanse.de>
Organization: BSD User Group Hamburg
References: <ts-0108961559090001@mac.infodirekt.de> <4tqksl$n1m@ezekiel.ieunet.ie>
Date: Thu, 1 Aug 96 20:22:57 GMT
Lines: 28

nick@Ireland.EU.net (Nick Hilliard) writes:

>Thomas Schreiber (ts@infodirekt.de) said:
>: What is the best way to copy directory trees with preserving
>: access dates, permissions, links and so on?

>: I know about

>:   cp -pr
>:   tar cf - | (cd destdir; tar xf -)

>tar -cf - foo | (cd destdir; tar xpf -) works better.  If you have GNU cp
>lying the place, 'cp -av' does the job nicely.  You could also use some
>combination of dump and restore, but that only works for whole filesystems.

GNU tar has a number of problems, too. The copy is not really
verbatim. I suggest using pax(1). As far as I can tell, it is the tool
that copies most things correctly.

rsync, although intended for remote copies, seems to do a rather good
job, too. 

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@wavehh.hanse.de> http://www.bik-gmbh.de/~cracauer
                    Where do you want to go today? 
          Hard to tell running your calendar on a junk OS, eh?