System Administration Guide

How to Copy All Files in a Directory to a Tape (cpio)

  1. Insert a tape that is not write-protected into the tape drive.

  2. Copy files to a tape using the ls and cpio commands.


    $ ls | cpio -oc > /dev/rmt/n
    

    ls

    Provides the cpio command with a list of file names.

    cpio -oc

    Specifies that cpio should operate in copy-out mode (-o) and write header information in ASCII character format (-c). This ensures portability to other vendor systems.

    > /dev/rmt/n

    Specifies the output file. 

    All of the files in the directory are copied to the tape in the drive you specify, overwriting any existing files on the tape. The total number of blocks copied is displayed.

  3. Verify the files are copied to tape by using the following cpio command.


    $ cpio -civt < /tmp/cpio.file
    
  4. Remove the tape from the drive and write the names of the files on the tape label.

Example--Copying All Files in a Directory to a Tape (cpio)

In this example, all of the files in the directory /export/home/kryten are copied to the tape in tape drive 0.


$ cd /export/home/kryten
$ ls | cpio -oc > /dev/rmt/0
8 blocks
$ cpio -civt < /tmp/cpio.file
drwxr-xr-x  2 kryten  users    0   Oct 24 11:05 1996, letters
drwxr-xr-x  2 kryten  users    0   Oct 24 11:05 1996, memos
drwxr-xr-x  2 kryten  users    0   Nov  8 14:14 1996, reports
8 blocks
$