tar: problems with exclude
1
1 Problems with Using the 'exclude' Options
1 -----------------------------------------
1
1 Some users find 'exclude' options confusing. Here are some common
1 pitfalls:
1
1 * The main operating mode of 'tar' does not act on a file name
1 explicitly listed on the command line, if one of its file name
1 components is excluded. In the example above, if you create an
1 archive and exclude files that end with '*.o', but explicitly name
1 the file 'dir.o/foo' after all the options have been listed,
1 'dir.o/foo' will be excluded from the archive.
1
1 * You can sometimes confuse the meanings of '--exclude' and
1 '--exclude-from'. Be careful: use '--exclude' when files to be
1 excluded are given as a pattern on the command line. Use
1 '--exclude-from' to introduce the name of a file which contains a
1 list of patterns, one per line; each of these patterns can exclude
1 zero, one, or many files.
1
1 * When you use '--exclude=PATTERN', be sure to quote the PATTERN
1 parameter, so GNU 'tar' sees wildcard characters like '*'. If you
1 do not do this, the shell might expand the '*' itself using files
1 at hand, so 'tar' might receive a list of files instead of one
1 pattern, or none at all, making the command somewhat illegal. This
1 might not correspond to what you want.
1
1 For example, write:
1
1 $ tar -c -f ARCHIVE.TAR --exclude '*.o' DIRECTORY
1
1 rather than:
1
1 # _Wrong!_
1 $ tar -c -f ARCHIVE.TAR --exclude *.o DIRECTORY
1
1 * You must use use shell syntax, or globbing, rather than 'regexp'
1 syntax, when using exclude options in 'tar'. If you try to use
1 'regexp' syntax to describe files to be excluded, your command
1 might fail.
1
1 *
1 In earlier versions of 'tar', what is now the '--exclude-from'
1 option was called '--exclude' instead. Now, '--exclude' applies to
1 patterns listed on the command line and '--exclude-from' applies to
1 patterns listed in a file.
1