cpio(1) DG/UX 4.30 cpio(1)
NAME
cpio - copy file archives in and out
SYNOPSIS
cpio -o [ abchsuvBSV ] [ -C (record size) ] [ -O (filename)
[ -M (message) ] ]
cpio -i [ bcdmfrstuvBSV6k ] [ -C (record size) ] [ -I
(filename) [ -M (message) ] ] [ patterns ]
cpio -p [ abdhlmusvLV ] directory
DESCRIPTION
Cpio -o (copy out) reads the standard input to get a list of
pathnames and copies those files onto the standard output
together with path name and status information. Output is
padded to a 512-byte boundary by default. DG cpio produces
unswapped binary headers by default.
Cpio -i (copy in) 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.
Cpio will automatically determine whether the archive is in
default binary header format or in ASCII (-c option) header
format. Also, it will match the byte order of the headers.
However, if you use the -c option to create an archive, you
must use the -c option to read that archive.
Patterns are given in the name-generating notation of sh(1).
In patterns, meta-characters ?, *, and [...] match the
slash / character, and backslash (\) is an escape character.
A ! meta-character means not. (For example, the !abc*
pattern would exclude all files that begin with abc.) You
can specify more than one pattern. If no patterns are
specified, the default for patterns is * (i.e., select all
files). The extracted files are conditionally created and
copied into the current directory tree based upon the
options described below.
The permissions of the files will be those of the previous
cpio -o. The owner and group of the files will be that of
the current user, unless the user is super-user, which
causes cpio to retain the owner and group of the files of
the previous cpio -o.
Cpio -p (pass) reads the standard input to get a list of
pathnames of files that are conditionally created and copied
into the destination directory tree, based on the options
described below. This is the only option that preserves
control point directories.
When extracting files, a special field in the header
Licensed material--property of copyright holder(s) Page 1
cpio(1) DG/UX 4.30 cpio(1)
determines whether or not the input is readable and allows
cpio to match the header format of the input. However, cpio
cannot determine the byte order of the file data; you must
use the -s -S, or -b option if you want data reorganization
to be done.
When using arguments, you must position the arguments in the
same order as the options. The options are:
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. The default record size is 512 bytes when this
and the C options are not used. (The B option does not
apply to the pass option; B is meaningful only with
data directed to or from a character special device,
e.g., /dev/rmt/??.)
d Directories are to be created as needed.
c Write header information in ASCII character form for
portability.
r Interactively rename files. If you type a null line,
the file is skipped. If you type a ".", the original
pathname will be copied.
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: prints a list of filenames. When used with
the t option, the table of contents looks like the
output of an ls -l command (see ls(1)).
l Whenever possible, link files rather than copying them.
Usable only with the -p option.
m Retain previous file modification time. Effective on
directories being copied only if the directory name is
specified following the filenames contained in the
directory.
-M message
Define a message to use when switching media. When you
use the -O or -I options and specify a character
special device, you can use this option to define the
message that is printed when you reach the end of the
medium. One %d can be placed in the message to print
the sequence number of the next medium needed to
continue.
-f Copy in all files except those in patterns.
-I file
Read the contents of file as input. If file is a
character special device, when the first medium is
full, replace the medium and type a carriage return to
continue to the next medium. Use only with the -i
option.
-k Attempt to skip corrupted file headers and I/O errors
Licensed material--property of copyright holder(s) Page 2
cpio(1) DG/UX 4.30 cpio(1)
that may be encountered. If you want to copy files
from a medium that is corrupted or out of sequence,
this option lets you read only those files with good
headers. (For cpio archives that contain other cpio
archives, if an error is encountered, cpio may
terminate prematurely. cpio will find the next good
header, which may be one for a smaller archive, and
terminate when the smaller archive's trailer is
encountered.) Used only with the -i option.
s Swap data bytes. Meaningful only with the -i option.
S Swap data halfwords. Meaningful only with the -i
option.
b Swap both data bytes and data halfwords. Meaningful
only with the -i option.
h Do not handle symbolic links; use what the link points
to instead.
L Create symbolic links instead of copying file. (This
option can be used only with the -p option.)
-O file
Write the output to file. If file is a character
special device, when the first medium is full, replace
the medium and type a carriage return to continue to
the next medium. (This option can be used only with
the -o option.)
I <f>
Read the input from the file f. (This option can be
used only with the -i option.)
V Print a period for each file processed. This option
provides an unobtrusive way to assure the user that
cpio is working.
C <n>
Record size is n bytes. The default record size is 512
bytes when this option and B are not used. (C does not
apply to the pass option; C is only meaningful with
data directed to or from a character special device,
e.g., /dev/rmt/0m.)
6 Process a file that is in UNIX Version Sixth Edition
format. Useful only with -i (copy in).
NOTE:
cpio assumes four-byte words.
If cpio reaches end of medium (end of a diskette for
example), when writing to (with -o) or reading from (with
-i) a character special device and -O and -I are not being
used, cpio will print the message:
If you want to go on, type device/file name when ready.
To continue, you must replace the medium and type the
character special device name (st(insc@E(FFF8A000),4,0), for
example) and carriage return. You may want to continue by
Licensed material--property of copyright holder(s) Page 3
cpio(1) DG/UX 4.30 cpio(1)
directing cpio to use a different device. For example, if
you have two tape drives you may want to switch between them
so cpio can proceed while you are changing the tapes. (A
carriage return alone causes the cpio process to exit.)
EXAMPLES
$ ls *.c | cpio -oB >/dev/rmt/0n
This example copies all files in the working directory with
the .c extension to the tape on /dev/rmt/0n. The -B option
blocks the tape at 5120 bytes/record and writing the file to
/dev/rmt/0n leaves the tape positioned at end-of-file
(instead of rewinding it). For information on tape
positioning, see "Appendix A" in Installing and Managing the
DG/UX System.
$ cat namelist
bad_prog.c
big_prog.c
prog.c
$ cpio -ov < namelist > /dev/rmt/0
bad_prog.c
big_prog.c
prog.c
5 blocks
In this example cpio uses the contents of the file name_list
as a guide for what files to dump. When the -v switch is
used, cpio displays on the screen the names of the files it
succesfully dumps. Since the -B switch isn't used the
blocking factor will be 512 bytes/record.
$ cat /dev/rmt/0n > /dev/null
$ cpio -iub < /dev/rmt/0
The cat command above positions the tape drive read/write
head at the beginning of the next tape file. The cpio
command then reads in that next tape file. When using the
-u switch with the cpio command, all files on the tape will
over-write any existing files with the same name.
SEE ALSO
ar(1), find(1), ls(1).
cpio(4) in the Programmer's Reference for the DG/UX System
NOTES
Path names are restricted to 256 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. The
default header format is an unportable binary format; the
Licensed material--property of copyright holder(s) Page 4
cpio(1) DG/UX 4.30 cpio(1)
-c option must be used to guarantee portability. If a file
has 000 permissions, contains more than 0 characters of
data, and the user is not root, the file will not be saved
or restored.
Licensed material--property of copyright holder(s) Page 5