|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
You can remove members from an archive by using the ‘--delete’
option. Specify the name of the archive with ‘--file’
(‘-f’) and then specify the names of the members to be deleted;
if you list no member names, nothing will be deleted. The
‘--verbose’ option will cause
tar to print the names
of the members as they are deleted. As with ‘--extract’, you
must give the exact member names when using ‘tar --delete’.
‘--delete’ will remove all versions of the named file from the
archive. The ‘--delete’ operation can run very slowly.
Unlike other operations, ‘--delete’ has no short form.
This operation will rewrite the archive. You can only use ‘--delete’ on an archive if the archive device allows you to write to any point on the media, such as a disk; because of this, it does not work on magnetic tapes. Do not try to delete an archive member from a magnetic tape; the action will not succeed, and you will be likely to scramble the archive and damage your tape. There is no safe way (except by completely re-writing the archive) to delete files from most kinds of magnetic tape. See section Tapes and Other Archive Media.
To delete all versions of the file ‘blues’ from the archive ‘collection.tar’ in the ‘practice’ directory, make sure you are in that directory, and then,
$ tar --list --file=collection.tar blues folk jazz rock $ tar --delete --file=collection.tar blues $ tar --list --file=collection.tar folk jazz rock
The ‘--delete’ option has been reported to work properly when
tar acts as a filter from
This document was generated by Sergey Poznyakoff on March, 12 2011 using texi2html 1.78.