[student@h006 work]$ find . -mtime -10 | cpio -o -H newc > /tmp/new.cpio 3 blocks # 大容量システムでは警告メッセージが出力される場合があります $ find . -mtime -10 -print | cpio -o > /tmp/new.cpio cpio: txtana: truncating inode number cpio: cpio: truncating inode number cpio: fbiff: truncating inode number 8 blocks
[student@h006 work]$ cpio -tvf < /tmp/new.cpio drwxrwxr-x 2 student student 0 Jul 22 09:45 . -rw-r--r-- 1 student student 43 Jul 15 12:35 name.data -rw-rw-r-- 1 student student 43 Jul 15 12:35 name.list -rw-rw-r-- 1 student student 567 Jul 15 10:15 versions.txt 3 blocks
[student@h006 work]$ cpio -iv < /tmp/new.cpio . name.data name.list cpio: versions.txt not created: newer or same age version exists # ファイル versions.txt はアーカイブより新しいので上書きしない。 versions.txt 3 blocks
[student@h006 work]$ cpio -iuv < /tmp/new.cpio . name.data name.list versions.txt 3 blocks
[student@h006 work]$ cpio -ir < /tmp/new.cpio rename . -> rename name.data -> name.new # 既存のファイル名を修正する場合は、ファイル名を rename name.list -> # 上書きの場合は単に[Enter]を入力 rename versions.txt -> 3 blocks [student@h006 work]$ ls MM20180708.txt name.data name.list name.new versions.txt
# 8バイトのテキストデータを作成(改行コードを除くため、 echo コマンドの継続行(\c)を用いている。 [student@h006 work]$ echo -e "1234ABCD\c" > a.dat [student@h006 work]$ cpio -o > data.cpio a.dat ^D 1 block # 32bit中 8bitづつを全て並び換え [student@h006 work]$ cpio -iub < data.cpio;cat a.dat 1 block 4321DCBA[student@h006 work]$ # 16bit中 8bitづつ並び替え [student@h006 work]$ cpio -ius < data.cpio;cat a.dat 1 block 2143BADC[student@h006 work]$ # 32bit中 16bitづつを入替え [student@h006 work]$ cpio -iuS < data.cpio;cat a.dat 1 block 3412CDAB[student@h006 work]$
[student@h006 work]$ find . -name "name*" | cpio -ovH ustar > /tmp/bkup.tar ./name.data ./name.list 6 blocks [student@h006 work]$ tar tvf /tmp/bkup.tar -rw-r--r-- student/student 43 2018-07-22 10:09 name.data -rw-rw-r-- student/student 43 2018-07-22 10:09 name.list