(tar)Selection Options
Prev:
Characteristics Up:
Specifying Names to tar
Local file selection
====================
*(This message will disappear, once this node revised.)*
Local file selection
`-C DIR'
`--directory DIR'
Change to directory DIR.
This option causes `tar' to change into the directory DIR before
continuing. This option can be interspersed with the files `tar'
is to work on. For example,
tar -c iggy ziggy -C baz melvin
will place the files `iggy' and `ziggy' from the current directory
on the tape, followed by the file `melvin' from the directory
`baz'. This option is especially useful when you have several
widely separated files that you want to store in the same
directory in the archive.
Here, the file `melvin' is recorded in the archive under the
precise name `melvin', *not* `baz/melvin'. Thus, the archive will
contain three files that all appear to have come from the same
directory; if the archive is extracted with plain `tar -x', all
three files will be created in the current directory.
Contrast this with the command:
tar -c iggy ziggy bar/melvin
which records the third file in the archive under the name
`bar/melvin' so that, if plain `tar -x' is used, the third file
will be created in a subdirectory named `bar'.
Suppose that, without changing your current directory, you want to
call `tar' to dump files from `/users/ctd/dipp' say. Then
`--directory=DIRECTORY' (`-C DIRECTORY') is for you. You could do
things like:
tar cfC archive.tar /users/ctd/dipp .
(the `.' means the current directory, once the
`--directory=DIRECTORY' (`-C DIRECTORY') obeyed).
Some people might want some option to extract everything from an
archive in the current directory, ignore directory structure in
the archive. This is so rarely proper that I doubt such an option
would be really useful. It would only help getting around improper
`tar' usage, it might even encourage improper usage. In general,
`--directory=DIRECTORY' (`-C DIRECTORY') might be used to produce
archives with a cleaner structure in the first place.
`-T FILENAME'
`--files-from=FILENAME'
Get names to extract or create from file FILENAME.
Instead of taking the list of files to work on from the command
line, the list of files to work on is read from the file FILENAME.
If FILENAME is given as `-', the list is read from standard input.
Note that using both `-T -' and `-f -' will not work unless you
are using the `--create' (`-c') command.
This is typically useful when you have generated the list of files
to archive with `find'.
`--null'
This option causes `--files-from=FILE-OF-NAMES' (`-T
FILE-OF-NAMES') to read file names terminated by a NUL instead of
a newline, so files whose names contain newlines can be archived
using `--files-from=FILE-OF-NAMES' (`-T FILE-OF-NAMES'). The
`--null' option is just like the one in GNU `xargs' and `cpio',
and is useful with the `-print0' predicate of GNU `find'. In
`tar', `--null' also causes `--directory=DIRECTORY' (`-C
DIRECTORY') options to be treated as file names to archive, in
case there are any files out there called `-C'.
`--exclude=FILE'
Exclude file FILE.
`-X FILE'
`--exclude-from=FILE'
Exclude files listed in FILE.
This option causes `tar' to read a list of regular expressions (in
shell wildcard syntax), one per line, from FILE; `tar' will ignore
files matching those regular expressions. Thus if `tar' is called
as `tar -c -X foo .' and the file `foo' contains a single line
`*.o', no files whose names end in `.o' will be added to the
archive. Multiple `--exclude=PATTERN' options may be given.
`-P'
`--absolute-names'
Do not strip leading `/'s from file names.
By default, GNU `tar' drops a leading `/' on input or output.
This option turns off this behavior; it's equivalent to changing
to the root directory before running `tar' (except it also turns
off the usual warning message).
`-l'
`--one-file-system'
Stay in local filesystem when creating archive.
This option causes `tar' to not cross filesystem boundaries when
archiving parts of a directory tree. This option only affects
files that are archived because they are in a directory that is
archived; files named on the command line are archived regardless,
and they can be from various file systems.
This option is useful for making full or incremental archival
backups of a filesystem, as with the Unix `dump' command.
Files skipped due to this option are mentioned on standard error.
`-K NAME'
`--starting-file=NAME'
Begin at file NAME in the archive.
The `--starting-file=NAME' (`-K NAME') option causes `tar' to begin
extracting or listing the archive with the file FILENAME, and to
consider only the files starting at that point in the archive.
This is useful if a previous attempt to extract files failed when
it reached FILENAME due to lack of free space. (Assuming, of
course, that there is now free space, or that you are now
extracting into a different file system.)
`-N DATE'
`--newer=DATE'
`--after-date=DATE'
Only store files newer than DATE.
This option causes `tar' to only work on files whose modification
or inode-changed times are newer than the DATE given. The main
use is for creating an archive; then only new files are written.
If extracting, only newer files are extracted.
Remember that the entire date argument must be quoted if it
contains any spaces.
The date is parsed using `getdate'.
Changing the Names of Members when Archiving
Changing Directory-
Absolute File Names-
automatically generated by info2www version 1.2