Previous Table of Contents Next


-p directory The pass option allows you to copy a directory tree from a source location to a new destination. It works somewhat like the copy out option except the output is written to a directory. The files in the current directory are copied to the new directory. For example,
ls | cpio -p /u2/doc/aba
copies all the files in the current directory to the directory /u2/doc/aba.


The following options may be used to control how cpio functions.

-6 Causes cpio to process an old UNIX Version 6 format cpio archive file. Only usable with the -i option.
-a Causes the access times of the input files to be reset to the time they had before cpio archived them. Without the -a option the access times are updated. Access times for linked files are not reset.
-A Appends files to a floppy disk or hard disk archive. Requires the -O option.
-b Reverses the order of the bytes in a word. A word is four bytes long. For example, if a word contained "1234," the result would be "4321." Only usable with the -i option.
-B Changes the input and output block size to 5120 bytes. This speeds up I/O in certain cases. This is only useful on character special devices, such as tape drives, for example, a 9-track tape drive /dev/rmt/0m (/dev/rmt16 - BSD).
-c Generates internal header information in ASCII character format. This provides for better portability among different computers. If you plan on creating a tape on one system and loading it on another, you should use this option.
-C size Specifies Input/Output buffers to be size byte records. The default bufsize is 512 when -C or -B are not used. Only effective when I/O is from/to a character special device and not a disk.
-d Forces cpio to create directories as needed. This is used in conjunction with the -i and -p options to create directories that exist in the archive file or in the source directory structure.
-E file Specify a file file which contains a list of filenames to extract from the archive, one filename per line.
-f Reverses the selection of patterns. All files that do not match the given patterns are copied in from the archive file.
-H hdr Read or write header information in hdr format. Mutually exclusive with the -c and -6 options. Use this option when the originating and destination systems are different operating systems and/or architectures. The valid hdr values are
ASCII header with expanded device numbers and per-file checksums.
IEEE/P1003 Data Interchange Standard header and format.
Tar(tar) header and format.
odc ASCII header with unexpanded(small) device numbers.
-I file Read contents of file as the input archive. If file is a character special device, when the current medium(floppy diskette) is completly read, replace it and press Return to read the next one. Only usable with the -i option. See -M option.
-k Attempt to skip corrupted file headers and I/O errors. Normally cpio terminates abnormally when errors are encountered.
-l If possible, link files instead of copying them. Only usable with the -p option.
-L Follow symbolic links.
-m Retains the modification time of the file from the time of archival. Modification times of directories are not retained; only times of files are kept.
-M msg Defines a message msg to use when the -I or -O options are specified with a character special device. The message is displayed when the end of the media is reached. A single %d may be used in the message to display a sequence number of the next medium needed.
-O file Writes the output to file file. If file is a character special device and is full, replace the current medium and press Return to continue. See -M option.
-r Allows interactive renaming of files. If you type in a Return after a prompt with no filename, the file is skipped. This option cannot be used with the -p option.
-R ID Reassigns ownership and group permission for each file to user ID ID. Only the super-user can use this option. The user ID must be a valid ID in /etc/passwd.
-s Swaps the bytes within each halfword. A word is made up of four bytes. This is the same as swapping every other byte. Thus it provides a way to swap the high and low order bytes on a two-word machine.
-S Swaps every halfword with the next halfword. Swaps every two bytes with the next two bytes. You can only use this option with the -i option.
-t Displays a table of contents for the files stored in the archive file. No files are extracted or created.
-u Unconditionally copies files to their destination. Normally an older archive file with the same filename as an existing file will not overwrite the existing file.
-v Causes cpio to be verbose in its actions. Displays a list of filenames being archived or retrieved. If you use -v with the -t option, the output resembles the output of the ls -l command.
-V Terse verbose. A dot is printed for each file read or written. Assures you that cpio is working without displaying the filenames.

Previous Table of Contents Next