cpio—copy file archives in and out

cpio –i [ bBcdfkmrsStuvV6 ] [ –C bufsize ] [ –E filename ] [ –H header ] [ –I filename [ –M message ] ] [ –R id ] [ pattern ... ]cpio –o [ aABcLvV ] [ –C bufsize ] [ –H header ] [ –O filename [ –M message ] ]cpio –p [ adlLmuvV ] [ –R id ] directory

Copies file archives according to the modifiers given, usually for backup to a tape or directory.

Example A.13.
find . -depth -print | cpio -pdmv /home/john/tmp

EXPLANATION

Starting at the current directory, find descends the directory hierarchy, printing each entries of the directory even if the directory does not have write permission, and sends the filenames to cpio to be copied into the john/tmp directory in the /home partition.

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.