[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
System User's Guide: Operating System and Devices

Copying Files from Tape or Disk (cpio -i Command)

The cpio -i command reads from standard input an archive file created by the cpio -o command and copies from it the files with names that match the Pattern parameter. These files are copied into the current directory tree. You can list more than one Pattern parameter, using the file name notation described in the ksh command. The default for the Pattern parameter is an * (asterisk), selecting all files in the current directory. In an expression such as [a-z], the minus sign means through according to the current collating sequence.

Note: The patterns "*.c" and "*.o" must be enclosed in quotation marks to prevent the shell from treating the * (asterisk) as a pattern-matching character. This is a special case in which the cpio command itself decodes the pattern-matching characters.

For example, to list the files that have been saved onto a diskette with the cpio command, enter:

cpio -itv </dev/rfd0

This displays the table of contents of the data previously saved onto the /dev/rfd0 file in the cpio command format. The listing is similar to the long directory listing produced by the li -l command. To list only the file path names, use only the -it flags.

For example, to copy the files previously saved with the cpio command from a diskette, enter:

cpio -idmv </dev/rfd0

This copies the files previously saved onto the /dev/rfd0 file by the cpio command back into the file system (specify the -i flag). The -d flag allows the cpio command to create the appropriate directories if a directory tree is saved. The -m flag maintains the last modification time in effect when the files are saved. The -v flag causes the cpio command to display the name of each file as it is copied.

For example, to copy selected files from diskette, enter:

cpio -i "*.c" "*.o" </dev/rfd0

This copies the files that end with .c or .o from diskette.

See the cpio command in the AIX Version 4.3 Commands Reference for more information and the exact syntax.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]