(This message will disappear, once this node revised.)
If you want to add files to an existing archive, then don't use `--create' (`-c'). That will erase the archive and create a new one in its place. Instead, use `--append' (`-r'). The command `tar --append --file=afiles.tar arbalest' would add the file `arbalest' to the existing archive `afiles.tar'. The archive must already exist in order to use `--append' (`-r').
As with `--create' (`-c'), the member names of the newly added files will be the exact same as their names given on the command line. The `--verbose' (`-v') option will print out the names of the files as they are written into the archive.
If you add a file to an archive using `--append' (`-r') with the same name as an archive member already present in the archive, then the old member is not deleted. What does happen, however, is somewhat complex.
FIXME: xref Multiple Members with the Same Name.
If you want to replace an archive member, use `--delete' first, and then use `--append' (`-r').
FIXME: we want people to use the script for backups, so I an not going FIXME: to use backups as an explanation in the tutorial. (people can still FIXME: do it if they really want to)
While you can use
tar to create a new archive every time you want
to store a file, it is more sometimes efficient to add files to an
To add new files to an existing archive, use the `--append' (`-r') operation. To add newer versions of archive members to an archive, use the `--update' (`-u') operation.
While you can use
tar to create an archive of an entire
directory or directory tree, it is more efficient when performing
backups to only archive those files which have been newly created or
changed since the last backup.
To add new files to an existing archive, or to add newer versions of old files, you can use the `--append' (`-r') operation, or the `--update' (`-u') operation.
Go to the first, previous, next, last section, table of contents.