pcpio -- copy file archives in and out


pcpio -o [ BLacv ]

pcpio -i [ Bcdfmrtuv ] [ pattern ... ]

pcpio -p [ aLdlmruv ] directory


The pcpio utility produces and reads files in the format specified by the cpio Archive/Interchange File Format specified in IEEE Std. 1003.1-1988.

The pcpio -i (copy in) utility extracts files from the standard input, which is assumed to be the product of a previous pcpio -o. Only files with names that match patterns are selected. Multiple patterns may be specified and if no patterns are specified, the default for patterns is ``*'', selecting all files. The extracted files are conditionally created and copied into the current directory, and possibly any levels below, based upon the options described below. The permissions of the files will be those of the previous pcpio -o. The owner and group of the files will be that of the current user unless the user has appropriate privileges, which causes pcpio to retain the owner and group of the files of the previous pcpio -o.

The pcpio -p (pass) utility reads the standard input to obtain a list of path names of files that are conditionally created and copied into the destination directory based upon the options described below.

If an error is detected, the cause is reported and the pcpio utility will continue to copy other files. pcpio will skip over any unrecognized files which it encounters in the archive.

pcpio takes the following options:

Input/output is to be blocked with 5120 bytes to the record. Can only be used with pcpio -o or pcpio -i for data that is directed to or from character special files.

Follow symbolic links.

Reset access times of input files after they have been copied. When the -l option is also specified, the linked files do not have their access times reset. Can only be used with pcpio -o or pcpio -i.

Write header information in ASCII character for portability. Can only be used with pcpio -i or pcpio -o. Note that this option should always be used to write portable files.

Creates directories as needed. Can only be used with pcpio -i or pcpio -p.

Copy in all files except those in patterns. Can only be used with pcpio -i.

Whenever possible, link files rather than copying them. Can only be used with pcpio -p.

Retain previous modification times. This option is ineffective on directories that are being copied. Can only be used with pcpio -i or pcpio -p.

Interactively rename files. The user is asked whether to rename pattern each invocation. Read and write permissions for /dev/tty are required for this option. If the user types a null line, the file is skipped. Should only be used with pcpio -i or pcpio -o.

Print a table of contents of the input. No files are created. Can only be used with pcpio -i.

Copy files unconditionally; usually an older file will not replace a new file with the same name. Can only be used with pcpio -i or pcpio -p.

Verbose: cause the names of the affected files to be printed. Can only be used with pcpio -i. Provides a detailed listing when used with the -t option.
pcpio accepts the following operands:

Simple regular expressions given in the name-generating notation of the shell.

The destination directory.

Exit values

The pcpio utility exits with one of the following values:

All input files were copied.

The utility encountered errors in copying or accessing files or directories. An error will be reported for nonexistent files or directories, or permissions that do not allow the user to access the source or target files.


Copy out the files in the current directory listed by the ls utility and redirects them to the file /tmp/newfile:

ls | pcpio -o > /tmp/newfile

As above, but use find(C) to copy the files in the current directory and in directories below it:

find . -depth -print | pcpio -o > /tmp/newfile

Use the output file /tmp/newfile from the pcpio -o utility, take those files that match the patterns memo/al and memo/b*, create the directories below the current directory, and place the files in the appropriate directories:

cat /tmp/newfile | pcpio -id "memo/al" "memo/b*"

Take the filenames piped from the find utility and copy or link those files to another directory named newdir, while retaining the modification time:

find . -depth -print | pcpio -pdlmv newdir


It is important to use the -depth option of the find utility to generate pathnames for pcpio. This eliminates problems pcpio could have trying to create files under read-only directories.

When find and pcpio are used in conjunction, specify the -follow option to find and the -L option to pcpio when symbolic links are to be followed.

The following restrictions apply to the pcpio utility:


used to prompt the user for information when the -i or -r options are specified

See also

cpio(C), find(C), pax(C), ptar(C), tar(C), tar(F)

Standards conformance

pcpio is not part of any currently supported standard; it was developed by Mark H. Colburn of NAPS International, 117 Mackubin Street, Suite 1, St. Paul, MN 55102 (mark@jhereg.MN.ORG), as sponsored by The USENIX Association for public distribution, and is used with permission.

Copyright (c) 1989 Mark H. Colburn.
All rights reserved.

NIST FIPS 151-2.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003