Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Sep 2011 10:59:05 -0400
From:      "joeb1" <joeb1@a1poweruser.com>
To:        "Questions@Freebsd. Org" <questions@freebsd.org>
Subject:   FW: cpio command and schg flags
Message-ID:  <NBECLJEKGLBKHHFFANMBCEFACPAA.joeb1@a1poweruser.com>

next in thread | raw e-mail | index | archive | help


> 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?

Did you copy under root? BSD cpio unlike GNU cpio does preserve file flags.

  $ cpio --version
  bsdcpio 2.8.4 -- libarchive 2.8.4

  $ find /lib | sudo cpio -dmp test
  56525 blocks

  $ ls -lo test/lib | awk '$5 != "-"'
  total 15595
  -r--r--r--  1 root  wheel  schg 4440677 Sep  5 22:24 libc.so.7
  -r--r--r--  1 root  wheel  schg  131655 Sep  5 22:24 libcrypt.so.5
  -r--r--r--  1 root  wheel  schg  592241 Sep  5 22:24 libthr.so.3




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