System Administration Guide

How to Retrieve All Files From a Tape (cpio)

If the archive was created using relative path names, the input files are built as a directory within the current directory when you retrieve the files. If, however, the archive was created with absolute path names, the same absolute paths are used to recreate the file on your system.


Caution - Caution -

Using absolute path names can be dangerous because you may overwrite existing files on your system.


  1. Change to the directory where you want to put the files.

  2. Insert the tape into the tape drive.

  3. Copy all files from the tape to the current directory using the cpio command.


    $ cpio -icvd < /dev/rmt/n
    

    -i

    Reads in the contents of the tape. 

    -c

    Specifies that cpio should read files in ASCII character format.

    -v

    Displays the output in a format similar to the output from the ls -l command.

    -d

    Create directories as needed. 

    < /dev/rmt/n

    Specifies the output file. 

  4. Verify the files are copied by listing the contents of the current directory.


    $ ls -l
    

Example--Retrieving All Files From a Tape (cpio)

In this example, all files are copied from the tape in drive 0.


$ cd /var/tmp
cpio -icvd < /dev/rmt/0
answers sc.directives tests
8 blocks
$ ls -l