*BSD News Article 75319


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.mira.net.au!news.vbc.net!alpha.sky.net!news.sprintlink.net!news-chi-13.sprintlink.net!news.sprintlink.net!news-chi-8.sprintlink.net!EU.net!sun4nl!wirehub!news.euro.net!xs4all!plm.xs4all.nl!plm
From: Peter Mutsaers <plm@xs4all.nl>
Subject: Re: Best way to copy directory trees
X-Newsreader: Gnus v5.2.26/Emacs 19.31
Sender: plm@localhost.xs4all.nl
Organization: My Unorganized Home
Lines: 20
Message-ID: <876872tii3.fsf@localhost.xs4all.nl>
References: <ts-0108961559090001@mac.infodirekt.de>
Date: Fri, 2 Aug 1996 06:20:04 GMT

>> On Thu, 01 Aug 1996 15:59:09 +0200, ts@infodirekt.de (Thomas
>> Schreiber) said:

    TS> I have installed a second drive on my FreeBSD 2.1 machine
    TS> and want to move a few file systems around now.

    TS> What is the best way to copy directory trees with preserving
    TS> access dates, permissions, links and so on?

    TS> I know about

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

cpio does:

find . -depth -print | cpio -dump destdir

(-dump is -p for pass through mode, -d for create dirs, -u for
unconditional, -m to preserve modification times)

The extra advantage is that using find to select the files to copy you
can have much finer control than copying just everything below the
current directory, if you want.
-- 
______________________________________________________________________
Peter Mutsaers       |  Abcoude (Utrecht), |     "Memento Mori"
plm@xs4all.nl        |  the Netherlands    |