GNU Info

Info Node: (tar.info)backup

(tar.info)backup


Next: Applications Prev: extract options Up: operations
Enter node , (file) or (file)node

Backup options
==============

   GNU `tar' offers options for making backups of files before writing
new versions.  These options control the details of these backups.
They may apply to the archive itself before it is created or rewritten,
as well as individual extracted members.  Other GNU programs (`cp',
`install', `ln', and `mv', for example) offer similar options.

   Backup options may prove unexpectedly useful when extracting archives
containing many members having identical name, or when extracting
archives on systems having file name limitations, making different
members appear has having similar names through the side-effect of name
truncation.  (This is true only if we have a good scheme for truncated
backup names, which I'm not sure at all: I suspect work is needed in
this area.)  When any existing file is backed up before being
overwritten by extraction, then clashing files are automatically be
renamed to be unique, and the true name is kept for only the last file
of a series of clashing files.  By using verbose mode, users may track
exactly what happens.

   At the detail level, some decisions are still experimental, and may
change in the future, we are waiting comments from our users.  So,
please do not learn to depend blindly on the details of the backup
features.  For example, currently, directories themselves are never
renamed through using these options, so, extracting a file over a
directory still has good chances to fail.  Also, backup options apply
to created archives, not only to extracted members.  For created
archives, backups will not be attempted when the archive is a block or
character device, or when it refers to a remote file.

   For the sake of simplicity and efficiency, backups are made by
renaming old files prior to creation or extraction, and not by copying.
The original name is restored if the file creation fails.  If a
failure occurs after a partial extraction of a file, both the backup
and the partially extracted file are kept.

`--backup[=METHOD]'
     Back up files that are about to be overwritten or removed.
     Without this option, the original versions are destroyed.

     Use METHOD to determine the type of backups made.  If METHOD is
     not specified, use the value of the `VERSION_CONTROL' environment
     variable.  And if `VERSION_CONTROL' is not set, use the `existing'
     method.

     This option corresponds to the Emacs variable `version-control';
     the same values for METHOD are accepted as in Emacs.  This option
     also allows more descriptive names.  The valid METHODs are:

    `t'
    `numbered'
          Always make numbered backups.

    `nil'
    `existing'
          Make numbered backups of files that already have them, simple
          backups of the others.

    `never'
    `simple'
          Always make simple backups.

`--suffix=SUFFIX'
     Append SUFFIX to each backup file made with `--backup'.  If this
     option is not specified, the value of the `SIMPLE_BACKUP_SUFFIX'
     environment variable is used.  And if `SIMPLE_BACKUP_SUFFIX' is not
     set, the default is `~', just as in Emacs.

   Some people express the desire to _always_ use the `--backup'
option, by defining some kind of alias or script.  This is not as easy
as one may think, due to the fact that old style options should appear
first and consume arguments a bit unpredictably for an alias or script.
But, if you are ready to give up using old style options, you may
resort to using something like (a Bourne shell function here):

     tar () { /usr/local/bin/tar --backup $*; }


automatically generated by info2www version 1.2.2.9