From owner-freebsd-questions@FreeBSD.ORG Tue Nov 30 18:33:11 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B554516A4CE for ; Tue, 30 Nov 2004 18:33:11 +0000 (GMT) Received: from mail4.speakeasy.net (mail4.speakeasy.net [216.254.0.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CF2B43D2D for ; Tue, 30 Nov 2004 18:33:11 +0000 (GMT) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: (qmail 9481 invoked from network); 30 Nov 2004 18:33:09 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail4.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 30 Nov 2004 18:33:09 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id 3235A69; Tue, 30 Nov 2004 13:33:09 -0500 (EST) Sender: lowell@be-well.ilk.org To: freebsd@orchid.homeunix.org References: <41AC7636.2050605@orchid.homeunix.org> From: Lowell Gilbert Date: 30 Nov 2004 13:33:09 -0500 In-Reply-To: <41AC7636.2050605@orchid.homeunix.org> Message-ID: <44acsz9ogq.fsf@be-well.ilk.org> Lines: 47 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: freebsd-questions@freebsd.org cc: kientzle@acm.org Subject: Re: bsdtar '--exclude pattern' problems X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Nov 2004 18:33:11 -0000 Karol Kwiatkowski writes: > Hello all, > > I upgraded 5.2.1 to 5.3 recently and I'm trying to run my cron scripts > which use tar utility (which defaults to bsdtar(1) on 5.3) and I can't > figure out how to use '--exclude pattern' with it. It seems I'm > missing something obvious here or bsdtar(1) is happily ignoring > --exclude option. > > my system: > FreeBSD 5.3-RELEASE-p1 #4: Sat Nov 27 19:37:42 CET 2004 > > here's what I try to run: > > orchid# /usr/bin/tar -czvf /home/root.backup/test.tar.gz -C /home . \ > --exclude "root.backup/*" --exclude "pub/*" --exclude "ncvs/*" > > I tried '-W exclude=pattern', too: > > orchid# /usr/bin/tar -czvf /home/root.backup/test.tar.gz -C /home . \ > -W exclude="root.backup/*" -W exclude="pub/*" -W exclude="ncvs/*" > > Both commands include all directories under /home. However using > /usr/bin/gtar works as expected. According to the tar(1) manual, the file parameters are supposed to come after all of the option parameters. So instead of > orchid# /usr/bin/tar -czvf /home/root.backup/test.tar.gz -C /home . \ > --exclude "root.backup/*" --exclude "pub/*" --exclude "ncvs/*" I think you should have > orchid# /usr/bin/tar -czvf /home/root.backup/test.tar.gz -C /home \ > --exclude "root.backup/*" --exclude "pub/*" --exclude "ncvs/*" . which seems to do what you're expecting. I don't have access to a copy of the POSIX spec, but I seem to recall that it generally expects the options first. So that may be where the behaviour originates. Be well. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/