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