Copyright (C) 2000-2012 |
GNU Info (tar.info)multipleMultiple Files 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'; Note: 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-rw-rw- me user 28 1996-10-18 16:31 jazz -rw-rw-rw- me user 21 1996-09-23 16:44 blues -rw-rw-rw- me user 20 1996-09-23 16:44 folk -rw-rw-rw- me user 20 1996-09-23 16:44 rock -rw-rw-rw- 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. Note: Writing, for more information. (_Please note:_ This is the case unless you employ the `--backup' option. .) automatically generated by info2www version 1.2.2.9 |