Solaris Handbook for Sun Peripherals

cpio Command

The cpio command (copy in/out) copies a list of files between devices by taking a list of names from standard input and writing to standard output. It is a versatile command but requires you to redirect standard-in and standard-out. cpio can be used when the amount of data requires the use of more that one volume (tape cartridge).

Example 1:

The following example shows how to copy the files in your working directory called /work and all subdirectories to the first tape drive with the logical device name of /dev/rmt/0.


example# cd /work
example# ls -R | cpio -ocB > /dev/rmt/0

Example 2:

The next example shows how to copy the files that are located on your tape back to your hard disk:


example# cd /work
example# cpio -icdB < /dev/rmt/0


Note -

You must use the same blocking factor when you retrieve or copy files from the tape to the hard disk as you did when you copied files from the hard disk to the tape. In such cases you must specify the B option.