*BSD News Article 75261


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!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.ysu.edu!news.cps.udayton.edu!news.engr.udayton.edu!blackbird.afit.af.mil!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!swrinde!howland.reston.ans.net!ixnews1.ix.netcom.com!ix.netcom.com!ix.netcom.com!netcom.com!gerg
From: gerg@netcom.com (Greg Andrews)
Subject: Re: Best way to copy directory trees
Message-ID: <gergDvH52n.6K9@netcom.com>
Organization:  Movie marquee:    THE FLY  GODS MUST BE CRAZY  ALIENS
References: <ts-0108961559090001@mac.infodirekt.de>
Date: Thu, 1 Aug 1996 19:35:11 GMT
Lines: 31
Sender: gerg@netcom23.netcom.com

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 know about
>
>  cp -pr
>  tar cf - | (cd destdir; tar xf -)
>
>but both seem to not exactly preserve directory trees.
>

I've always used:

  cd /path/to/old/dir
  find . -depth -print | cpio -pdmv /path/to/new/dir


Found that in the man page for cpio on SunOS 4.1.x.  I'm surprised
that the FreeBSD man page doesn't give any examples of common uses.
(that was v2.1.0-RELEASE, btw)

  -Greg
-- 
:::::::::::::::::::  Greg Andrews  gerg@netcom.com  :::::::::::::::::::
ObGuindon:  Caution: This jacket has 37 Velcro(tm) closures.
            Do not hug a moose with the flaps open.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::