--append
@UNREVISED
If you want to add files to an existing archive, you don't need to create a new archive; you can use --append (-r). The archive must already exist in order to use `--append'. (A related operation is the `--update' operation; you can use this to add newer versions of archive members to an existing archive. To learn how to do this with `--update', see section Updating an Archive.)
@FIXME{Explain in second paragraph whether you can get to the previous version -- explain whole situation somewhat more clearly.}
If you use --append (-r) to add a file that has the same name as an
archive member to an archive containing that archive member, then the
old member is not deleted. What does happen, however, is somewhat
complex. tar
allows you to have infinite numbers of files
with the same name. Some operations treat these same-named members no
differently than any other set of archive members: for example, if you
view an archive with --list (-t), you will see all of those members
listed, with their modification times, owners, etc.
Other operations don't deal with these members as perfectly as you might
prefer; if you were to use --extract (--get, -x) to extract the archive,
only the most recently added copy of a member with the same name as four
other members would end up in the working directory. This is because
`--extract' extracts an archive in the order the members appeared
in the archive; the most recently archived members will be extracted
last. Additionally, an extracted member will overwrite a file of
the same name which existed in the directory already, and tar
will not prompt you about this. Thus, only the most recently archived
member will end up being extracted, as it will overwrite the one
extracted before it, and so on.
@FIXME{ hag -- you might want to incorporate some of the above into the MMwtSN node; not sure. i didn't know how to make it simpler...}
There are a few ways to get around this. @FIXME-xref{Multiple Members with the Same Name}.
If you want to replace an archive member, use --delete to delete the member you want to remove from the archive, , and then use `--append' to add the member you want to be in the archive. Note that you can not change the order of the archive; the most recently added member will still appear last. In this sense, you cannot truely "replace" one member with another. (Replacing one member with another will not work on certain types of media, such as tapes; see section Removing Archive Members Using `--delete' and section Tapes and Other Archive Media, for more information.)
Go to the first, previous, next, last section, table of contents.