tar and --include

Martin McCormick martin at dc.cis.okstate.edu
Wed May 19 15:50:51 UTC 2010


A few days ago, I asked about the --include directive in tar
after things didn't quite work the way the man page seemed to
indicate. One might get the impression that if --include or
--include='*pattern*' was added to a tar command, tar would only
archive what was in the pattern and not archive everything as
its default operation.

	What I discovered was that --include doesn't appear to
do anything at all. The example in the man page shows using it
to filter an existing archive and make a tar file of what was in
the existing archive that also matched the pattern. I never
tried that since that is not what was needed here.

	What turned out to work very well was to use the feature
in tar that lets one exclude a whole list of patterns in a
designated file. You just put in what shouldn't be in the
archive and it appeared to work fine.

	The --include directive only seems to exist in the
FreeBSD form of tar. I tried a Linux system's tar man page and
it is not there but both support the -X path/filename for a list
of exclusion patterns.

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Telecommunications Services Group


More information about the freebsd-questions mailing list