Go to the previous, next section.

Selecting Files by Characteristic

To avoid crossing file system boundaries when archiving parts of a directory tree, use `--one-file-system' (`-l'). This option only affects files that are archived because they are in a directory that is being archived; files explicitly named on the command line are archived regardless of where they reside.

This option is useful for making full or incremental archival backups of a file system.

If this option is used in conjunction with `--verbose' (`-v'), files that are excluded are mentioned by name on the standard error.

`--one-file-system'
`-l'
Prevents tar from crossing file system boundaries when archiving. Use in conjunction with any write operation.

To avoid operating on files whose names match a particular pattern, use the `--exclude=pattern' or `--exclude-from=file-of-patterns' (`-X file-of-patterns') options.

When you specify the `--exclude=pattern' option, tar ignores files which match the pattern, which can be a single file name or a more complex expression. Thus, if you invoke tar with `tar --create --exclude=*.o', no files whose names end in `.o' are included in the archive.

FIXME: what other things can you use besides "*"?

`--exclude-from=file-of-patterns' (`-X file-of-patterns') acts like `--exclude=pattern', but specifies a file file containing a list of patterns. tar ignores files with names that fit any of these patterns.

You can use either option more than once in a single command.

`--exclude=pattern'
Causes tar to ignore files that match the pattern.

`--exclude-from=file'
Causes tar to ignore files that match the patterns listed in file.
FIXME: --exclude-from used to be "--exclude", --exclude didn't used to
FIXME: exist.

To operate only on files with modification or status-change times after a particular date, use `--after-date=date' (`-N date'). You can use this option with `--create' (`-c') or `--append' (`-r') to insure only new files are archived, or with `--extract' (`-x') to insure only recent files are resurrected.

FIXME: or --newer date

`--newer-mtime=date' acts like `--after-date=date' (`-N date') but tests just the modification times of the files, ignoring status-change times.

FIXME: need example of --newer-mtime with quoted argument
Remember that the entire date argument should be quoted if it contains any spaces.

Please Note: `--after-date=date' (`-N date') and `--newer-mtime=date' should not be used for incremental backups. Some files (such as those in renamed directories) are not selected up properly by these options.

FIXME: xref to incremental backup chapter when node name is decided.

`--after-date=date'
`--newer=date'
`-N date'
Acts on files only if their modification or inode-changed times are later than date. Use in conjunction with any operation.
`--newer-mtime=date'
Acts like `--after-date=date' (`-N date'), but only looks at modification times.

FIXME: following is the getdate date format -- needs to be re-written,
FIXME: made a sub-node:

Time/Date Formats Accepted by getdate (omitting obscure constructions)

The input consists of one or more of: time zone day date year in any order.

Those in turn consist of (`|' and `/' mean `or', `[]' means `optional'):

time: H am/pm | H:M [am/pm] | H:M:S [am/pm] zone: timezone-name | timezone-name dst day: day-name | day-name, | N day-name date: M/D | M/D/Y | month-name D | month-name D, Y | D month-name | D month-name Y year: Y

am can also be a.m., pm can also be p.m. case and spaces around punctuation are not significant.

FIXME: month and day names can be abbreviated.

Go to the previous, next section.