[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
exclude
OptionsSome users find ‘exclude’ options confusing. Here are some common pitfalls:
tar
does not act on a file name
explicitly listed on the command line, if one of its file name
components is excluded. In the example above, if
you create an archive and exclude files that end with ‘*.o’, but
explicitly name the file ‘dir.o/foo’ after all the options have been
listed, ‘dir.o/foo’ will be excluded from the archive.
tar
sees wildcard characters
like ‘*’. If you do not do this, the shell might expand the
‘*’ itself using files at hand, so tar
might receive a
list of files instead of one pattern, or none at all, making the
command somewhat illegal. This might not correspond to what you want.
For example, write:
$ tar -c -f archive.tar --exclude '*.o' directory
rather than:
# Wrong! $ tar -c -f archive.tar --exclude *.o directory
regexp
syntax, when using exclude options in tar
. If you try to use
regexp
syntax to describe files to be excluded, your command
might fail.
tar
, what is now the
‘--exclude-from’ option was called ‘--exclude’ instead.
Now, ‘--exclude’ applies to patterns listed on the command
line and ‘--exclude-from’ applies to patterns listed in a
file.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 23, 2023 using texi2html 5.0.