From owner-freebsd-questions@FreeBSD.ORG Wed Dec 1 00:26:53 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 CEA4A16A4CE for ; Wed, 1 Dec 2004 00:26:53 +0000 (GMT) Received: from smtp104.rog.mail.re2.yahoo.com (smtp104.rog.mail.re2.yahoo.com [206.190.36.82]) by mx1.FreeBSD.org (Postfix) with SMTP id 3C93943D54 for ; Wed, 1 Dec 2004 00:26:53 +0000 (GMT) (envelope-from Mike.Jeays@rogers.com) Received: from unknown (HELO ?192.168.2.100?) (mjeays2551@24.114.152.139 with plain) by smtp104.rog.mail.re2.yahoo.com with SMTP; 1 Dec 2004 00:26:52 -0000 From: Mike Jeays To: freebsd@orchid.homeunix.org In-Reply-To: <41AC7636.2050605@orchid.homeunix.org> References: <41AC7636.2050605@orchid.homeunix.org> Content-Type: text/plain Organization: Message-Id: <1101860811.10293.5.camel@chaucer> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 30 Nov 2004 19:26:51 -0500 Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org Subject: Re: bsdtar '--exclude pattern' problems X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2004 00:26:53 -0000 On Tue, 2004-11-30 at 08:31, Karol Kwiatkowski wrote: > 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. > > Any help appreciated. Thanks. > > Karol Here is an example that works for me: tar -czf /usr/tmp/HOME.tar.gz \ --exclude home/mike/tmp/* \ --exclude home/mike/tmp?/* \ --exclude home/mike/moz/cache/* \ --exclude home/mike/sylmail \ --exclude home/mike/z/* \ /home/mike/* You need to leave off the leading "/", as it has already been stripped from the filename before the comparison. Took me some time to work this out!