cpio(1) DG/UX 4.31 cpio(1)
NAME
cpio - copy file archives in and out
SYNOPSIS
cpio -o [abchsuvBSV] [ -Csize ] [ -Ofile [ -Mmsg ] ]
cpio -i [bcdfkmrstuvBSV6] [-Csize] [-Ifile [-Mmsg]] [pat...]
cpio -p [abdhlmsuvLV] dir
size The number of bytes per record
file The name of the output or input file
msg The message to be used when switching media
pat A pattern for filename matching (described below);
default = * (i.e., select all files)
dir The destination 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 pathname 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 pat are selected. cpio
automatically determines whether the archive in default
binary header format or in ASCII (-c option) header format.
Also, it matches 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 pat, 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.) 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.
Licensed material--property of copyright holder(s) Page 1
cpio(1) DG/UX 4.31 cpio(1)
When extracting files, a special field in the header
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. Access times for parent directories may not be
reset.
-b Swap both data bytes and data halfwords. Meaningful
only with the -i option.
-c Write header information in ASCII character form for
portability.
-d Directories are to be created as needed.
-f Copy in all files except those in pat.
-h Do not handle symbolic links; use what the link points
to instead.
-k Attempt to skip corrupted file headers and I/O errors
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.
-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.
-r Interactively rename files. If you type a null line,
the file is skipped. If you type a ".", the original
pathname will be copied.
-s Swap data bytes. Meaningful only with the -i option.
-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)).
-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 option are not used. (The -B option does
not apply to the pass option; B is meaningful only with
Licensed material--property of copyright holder(s) Page 2
cpio(1) DG/UX 4.31 cpio(1)
data directed to or from a character special device,
e.g., /dev/rmt/??.)
-L Create symbolic links instead of copying file. (This
option can be used only with the -p option.)
-S Swap data halfwords. Meaningful 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.
-6 Process a file that is in UNIX Version Sixth Edition
format. Useful only with -i (copy in).
-Csize
Set the record size. The default is 512 bytes when
this option and -B are not used. (-C does not apply to
-p; -C is only meaningful with data directed to or from
a character special device, e.g., /dev/rmt/0m).
-Ofile
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.)
-Ifile
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.
-Mmsg
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.
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 prints 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
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
Licensed material--property of copyright holder(s) Page 3
cpio(1) DG/UX 4.31 cpio(1)
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 namelist
as a guide for what files to dump. When the -v option is
used, cpio displays on the screen the names of the files it
succesfully dumps. Since the -B option 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 option 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
Pathnames 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
-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 4