Go to the previous, next section.

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,

% 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:

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

Go to the previous, next section.