(tar)Creating a New Archive
Next:
Adding to an Existing Archive Prev:
Basic tar Operations Up:
Basic tar Operations
Creating a New Archive
======================
*(This message will disappear, once this node revised.)*
The `--create' (`-c') option causes `tar' to create a new archive.
The files to be archived are then named on the command line. Each file
will be added to the archive with a member name exactly the same as the
name given on the command line. (When you give an absolute file name
`tar' actually modifies it slightly,
FIXME: ref Absolute
Names
.) If you list no files to be archived, then an empty archive is
created.
If there are two many files to conveniently list on the command line,
you can list the names in a file, and `tar' will read that file.
FIXME: xref Reading Names from a File
.
If you name a directory, then `tar' will archive not only the
directory, but all its contents, recursively. For example, if you name
`/', then `tar' will archive the entire filesystem.
Do not use the option to add files to an existing archive; it will
delete the archive and write a new one. Use `--append' (`-r') instead.
(
FIXME: xref Adding to an Existing Archive
.)
There are various ways of causing `tar' to skip over some files, and
not archive them.
FIXME: xref Specifying Names to tar
.
FIXME: operations should probably have examples, not tables.
To create an archive, use `--create' (`-c'). To name the archive,
use `--file=ARCHIVE-NAME' in conjunction with the `--create' (`-c')
operation (
FIXME: pxref Archive Name
). If you do not name the archive, `tar' uses the value of the
environment variable `TAPE' as the file name for the archive, or, if
that is not available, `tar' uses a default archive name, usually that
for tape unit zero.
FIXME: xref Archive Name
, for more information about specifying an archive name.
The following example creates an archive named `stooges', containing
the files `larry', `moe' and `curley':
tar --create --file=stooges larry moe curley
If you specify a directory name as a file name argument, `tar' will
archive all the files in that directory. The following example creates
an archive named `hail/hail/fredonia', containing the contents of the
directory `marx':
tar --create --file=hail/hail/fredonia marx
If you don't specify files to put in the archive, `tar' archives all
the files in the working directory. The following example creates an
archive named `home' containing all the files in the working directory:
tar --create --file=home
FIXME: xref File Name Lists
, for other ways to specify files to archive.
Note: In the example above, an archive containing all the files in
the working directory is being written to the working directory. GNU
`tar' stores files in the working directory in an archive which is
itself in the working directory without falling into an infinite loop.
Other versions of `tar' may fall into this trap.
automatically generated by info2www version 1.2