Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Sep 2011 14:49:29 -0700
From:      Carl Johnson <carlj@peak.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: cpio command and schg flags
Message-ID:  <87ipp664nq.fsf@oak.localnet>
In-Reply-To: <20110905175808.6b534002.freebsd@edvax.de> (Polytropon's message of "Mon, 5 Sep 2011 17:58:08 %2B0200")
References:  <NBECLJEKGLBKHHFFANMBIEEOCPAA.joeb1@a1poweruser.com> <20110905175808.6b534002.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Polytropon <freebsd@edvax.de> writes:

> On Mon, 5 Sep 2011 11:32:05 -0400, joeb1 wrote:
>> I am trying to use this code sequence to clone a directory tree.
>> mkdir /usr/test1
>> cd /var
>> find . | cpio -dmp  /usr/test1
>> 
>> The result is  /usr/test1 gets populated with the directory tree but
>> all the schg flags get stripped off. 
>> 
>> How can I keep the schg flags in the cloned directory?
>
> As far as I remember, cpio doesn't copy flags. But you
> can use either dump + restore, or dpdup (from ports).
>
>>>From "man cpdup":
>
> 	The cpdup utility makes an exact mirror copy of
> 	the source in the destination, creating and
> 	deleting files and directories as necessary.
> 	UTimes, hardlinks, softlinks, devices, permissions,
> 	and flags are mirrored.
>
> Flags are explicitely mentioned here. Maybe you can give
> this program a try?

I think that tar will also work (but not gnu tar), and it is part of the
base system.  The manpage does show an example of how to do this, but
calls it moving the file heirarchy.

-- 
Carl Johnson		carlj@peak.org




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87ipp664nq.fsf>