From owner-freebsd-questions@FreeBSD.ORG Thu May 20 05:44:17 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90E23106564A for ; Thu, 20 May 2010 05:44:17 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from monday.kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 621F78FC14 for ; Thu, 20 May 2010 05:44:17 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.3/8.14.3) id o4K5i7kE046806; Thu, 20 May 2010 05:44:07 GMT (envelope-from kientzle@freebsd.org) Received: from horton.x.kientzle.com (fw2.kientzle.com [10.123.1.2]) by kientzle.com with SMTP id rrhec9ifiktvtydepgqah2dbje; Thu, 20 May 2010 05:44:06 +0000 (UTC) (envelope-from kientzle@freebsd.org) Message-ID: <4BF4CC14.3030809@freebsd.org> Date: Wed, 19 May 2010 22:43:48 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.23) Gecko/20100314 SeaMonkey/1.1.18 MIME-Version: 1.0 To: bf1783@gmail.com References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Martin McCormick , freebsd-questions@freebsd.org Subject: Re: tar and --include X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2010 05:44:17 -0000 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