(tar)How to Delete Members from Archives


Prev: How to Add Files to Existing Archives Up: Tutorial

How to Delete Members from Archives
===================================

     *(This message will disappear, once this node revised.)*

   You can delete members from an archive using `--delete'.  Specify
the name of the archive with `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME').
List the member names of the members to be deleted.  (If you list no
member names, then nothing will be deleted.)  The `--verbose' (`-v')
option will cause `tar' to print the names of the members as they are
deleted.  As with `--extract' (`-x'), it is important that you give the
exact member names when using `tar --delete'.  Use `--list' (`-t') to
find out the exact member names in an archive.
FIXME: xref Listing Archives.

   The `--delete' option only works with archives stored on disk.  You
cannot delete members from an archive stored on a tape.

   In some instances, it may be advantageous to remove some files from
an archive stored on disk (it is never advantageous to delete files from
an archive stored on tape--the linear nature of tape storage makes this
action likely to scramble the archive).  You can use the `--delete'
operation to remove files from an archive.  The names of files to be
removed must be specified to `tar' as file name arguments.  All
versions of the named file are removed from the archive.  Execution of
the `--delete' operation can be very slow.

   To delete all versions of the file `blues' from the archive
`records' in the `practice' directory, make sure you are in that
directory, and then,

   * List the contents of the archive file `records' (see above for the
     steps involved) to insure that the file(s) you wish to delete are
     stored in the archive.  (This step is optional)

   * Invoke `tar' and specify the operation to delete files from an
     archive (`--delete')

   * Specify the name of the archive file that the file(s) will be
     deleted--`--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME').

   * Specify the name(s) of the file(s) to be deleted, as file name
     arguments

   * List the contents of the archive file again--note that the files
     have been removed.  (this step is also optional)

     % tar --list --file=records
     blues
     folk
     jazz
     % tar --delete --file=records blues
     % tar --list --file=records
     folk
     jazz
     %

   In some instances, you may want to remove some files from an archive
stored on disk

     *Caution:* you should never delete files from an archive stored on
     tape-because of the linear nature of tape storage, doing this is
     likely to scramble the archive.

   To remove archive members from an archive, use the `--delete'
operation.  You must specify the names of files to be removed as file
name arguments.  All versions of the named file are removed from the
archive.

   Execution of the `--delete' operation can be very slow.

   To delete all versions of the file `blues' from the archive
`records' in the `practice' directory, make sure you are in that
directory, and then:

   * List the contents of the archive file `records' (see above for the
     steps involved) to insure that the file(s) you wish to delete are
     stored in the archive.  (This step is optional)

   * Invoke `tar' and specify the `--delete' operation (`--delete').

   * Specify the name of the archive file that the file(s) will be
     deleted from--`--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME').

   * Specify the files to be deleted, using file name arguments.

   * List the contents of the archive file again--note that the files
     have been removed.  (this step is also optional)

     % tar --list --file=records
     blues
     folk
     jazz
     % tar --delete --file=records blues
     % tar --list --file=records
     folk
     jazz
     %


automatically generated by info2www version 1.2