(tar.info.gz) multiple
Info Catalog
(tar.info.gz) appending files
(tar.info.gz) append
4.2.2.2 Multiple Members with the Same Name
...........................................
You can use '--append' ('-r') to add copies of files which have been
updated since the archive was created. (However, we do not recommend
doing this since there is another 'tar' option called '--update';
update, for more information. We describe this use of '--append' here
for the sake of completeness.) When you extract the archive, the older
version will be effectively lost. This works because files are
extracted from an archive in the order in which they were archived.
Thus, when the archive is extracted, a file archived later in time will
replace a file of the same name which was archived earlier, even though
the older version of the file will remain in the archive unless you
delete all versions of the file.
Supposing you change the file 'blues' and then append the changed
version to 'collection.tar'. As you saw above, the original 'blues' is
in the archive 'collection.tar'. If you change the file and append the
new version of the file to the archive, there will be two copies in the
archive. When you extract the archive, the older version of the file
will be extracted first, and then replaced by the newer version when it
is extracted.
You can append the new, changed copy of the file 'blues' to the
archive in this way:
$ tar --append --verbose --file=collection.tar blues
blues
Because you specified the '--verbose' option, 'tar' has printed the name
of the file being appended as it was acted on. Now list the contents of
the archive:
$ tar --list --verbose --file=collection.tar
-rw-r--r-- me/user 28 1996-10-18 16:31 jazz
-rw-r--r-- me/user 21 1996-09-23 16:44 blues
-rw-r--r-- me/user 20 1996-09-23 16:44 folk
-rw-r--r-- me/user 20 1996-09-23 16:44 rock
-rw-r--r-- me/user 58 1996-10-24 18:30 blues
The newest version of 'blues' is now at the end of the archive (note the
different creation dates and file sizes). If you extract the archive,
the older version of the file 'blues' will be replaced by the newer
version. You can confirm this by extracting the archive and running
'ls' on the directory.
If you wish to extract the first occurrence of the file 'blues' from
the archive, use '--occurrence' option, as shown in the following
example:
$ tar --extract -vv --occurrence --file=collection.tar blues
-rw-r--r-- me/user 21 1996-09-23 16:44 blues
Writing, for more information on '--extract' and see
-occurrence Option Summary, for a description of '--occurrence' option.
Info Catalog
(tar.info.gz) appending files
(tar.info.gz) append
automatically generated by
info2html