cpio(1)
NAME
cpio − copy file archives in and out
SYNTAX
cpio −o[acBv]
cpio −i[BcdmrtuvfsSb6] [ patterns ]
cpio −p[adlmruv] directory
DESCRIPTION
The cpio command with the −o option (copy out) specified reads the standard input to obtain a list of path names and copies those files onto the standard output together with path name and status information.
The cpio command with the −i option (copy in) specified extracts files from the standard input which is assumed to be the product of a previous cpio −o. Only files with names that match patterns are selected. Patterns are given in the name-generating notation of sh(1). In patterns, meta-characters ?, ∗, and [...] match the slash / character. Multiple patterns may be specified and if no patterns are specified, the default for patterns is ∗ (select all files). The extracted files are conditionally created and copied into the current directory tree based upon the options described below.
The cpio command with the −p option (pass) specified reads the standard input to obtain a list of path names of files that are conditionally created and copied into the destination directory tree based upon the options described below.
KEYS
a Reset access times of input files after they have been copied.
B Input/output is to be blocked 5,120 bytes to the record (does not apply to the pass option; meaningful only with data directed to or from /dev/rht?).
d Directories are created as needed.
c Write header information in ASCII character form for portability.
r Interactively rename files. If the user types a null line, the file is skipped.
t Print a table of contents of the input. No files are created.
u Copy unconditionally. Normally, an older file will not replace a newer file with the same name.
v Verbose: causes a list of file names to be printed. When used with the t option, the table of contents looks like the output of an ls −l command. For further information see ls(1).
l Whenever possible, link files rather than copying them. Usable only with the −p option.
m Retain previous file modification time. This option is ineffective on directories that are being copied.
f Copy in all files except those in patterns.
s Swap bytes. Use only with the −i option.
S Swap halfwords. Use only with the −i option.
b Swap both bytes and halfwords. Use only with the −i option.
6 Process an old (that is, UNIX System Sixth Edition format) file. Only useful with −i (copy in).
EXAMPLES
The first example copies the contents of a directory into an archive:
ls │ cpio −o >/dev/ht0
cd olddir
find . −print │ cpio −pdl newdir
The second example duplicates a directory hierarchy:
find . −print │ cpio −oB >/dev/rht0
However, this trivial case can be handled more efficiently by the following:
find . −cpio /dev/rht0
RESTRICTIONS
Path names are restricted to 128 characters. If there are too many unique linked files, the program runs out of memory to keep track of them and, thereafter, linking information is lost. Only the superuser can copy special files.