Date: Wed, 19 May 2010 22:43:48 -0700 From: Tim Kientzle <kientzle@freebsd.org> To: bf1783@gmail.com Cc: Martin McCormick <martin@dc.cis.okstate.edu>, freebsd-questions@freebsd.org Subject: Re: tar and --include Message-ID: <4BF4CC14.3030809@freebsd.org> In-Reply-To: <AANLkTilrvL7wDdpGdyT1YZjrai_f2Se024tBGWr0Bcn7@mail.gmail.com> References: <AANLkTilrvL7wDdpGdyT1YZjrai_f2Se024tBGWr0Bcn7@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
b. f. wrote:
> Martin McCormick wrote:
>> 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 ... I never
>> tried that since that is not what was needed here.
The --include directive was designed to support the
case of filtering an existing archive. GNU tar has
no equivalent to bsdtar's @archive feature and hence
has no real need for --include.
If you really need detailed control over which
files get archived, I do recommend learning how
to use find(1) in conjunction with tar. (Just remember
to use tar's -n option!)
> There certainly seems to be a bug here, either in the documentation or
> the implementation. The example you mention works as expected for me
> on 9-CURRENT, but the --include option fails on, for example:
>
> tar -cvf new.tar --include='baz' foo/bar
In your example here, the first item
tar inspects is "foo/bar", which does not match
the pattern and therefore is not included.
Excluding a directory excludes everything
in the directory.
The net result is the same as if you had specified:
tar -cvf new.tar --exclude='foo/bar' foo/bar
Cheers,
Tim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BF4CC14.3030809>
