# cpio and file flags



## dbi (Mar 22, 2010)

Hi,

It appears cpio is not preserving the file flags, while tar is. Is it the expected behaviour?


```
root@bsd # ll
total 6
drwxr-xr-x  2 root     wheel    -    2B Mar 22 17:45 .
drwxr-xr-x  4 root     wheel    -    4B Mar 22 15:42 ..
root@bsd # tar cpf - /mnt | tar xpf -
tar: Removing leading '/' from member names
root@bsd # find . -flags +schg
./mnt/sbin/init
./mnt/bin/rcp
./mnt/lib/libthr.so.3
./mnt/lib/libcrypt.so.5
./mnt/lib/libc.so.7
./mnt/libexec/ld-elf.so.1
root@bsd # chflags -R 0 *
root@bsd # rm -r *
zsh: sure you want to delete all the files in /data/exports/gate/bsd [yn]? y
root@bsd # find /mnt/ -depth -print0 | cpio -0pd .
403000 blocks
root@bsd # find . -flags +schg
root@bsd # rm -r *
zsh: sure you want to delete all the files in /data/exports/gate/bsd [yn]? y
root@bsd #
```

The system is 8.0-RELEASE-p2 amd64. On "/mnt" I have a network mounted read-only ad0s1a from another machine.


----------

