From owner-freebsd-questions Thu Sep 6 13:47:13 2001 Delivered-To: freebsd-questions@freebsd.org Received: from stargate.clickcom.com (stargate.clickcom.com [209.198.22.4]) by hub.freebsd.org (Postfix) with ESMTP id 3F31E37B407 for ; Thu, 6 Sep 2001 13:47:07 -0700 (PDT) Received: from fishbowl (dhcp-1.clt.clickcom.com [209.198.22.65]) by stargate.clickcom.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id SM465MLP; Thu, 6 Sep 2001 16:47:08 -0400 Reply-To: From: "John Straiton" To: "Francesco Casadei" , Subject: RE: Problem with the Exclude option of tar Date: Thu, 6 Sep 2001 16:46:07 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal In-Reply-To: <20010906155940.A2995@goku.kasby> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thanks. While this wasn't the solution, it did indicate to me what is the problem. The file quota.user is in the /home directory, not one of it's subs. When you tell tar that you want it to backup quota.user (cause it's part of `ls /home/`), then tell it to exclude it, it'll still write the file. Apparently this is by design, so filtering by if's in the .sh script is really the only way that I'll get it to do what I want (if the files are in /home/ instead of one of it's subdirectories) Thanks again, John > -----Original Message----- > From: Francesco Casadei [mailto:fcasadei@inwind.it] > Sent: Thursday, September 06, 2001 10:00 AM > To: jks@clickcom.com > Cc: freebsd-questions@freebsd.org > Subject: Re: Problem with the Exclude option of tar > > > On Wed, Sep 05, 2001 at 05:55:13PM -0400, John Straiton wrote: > > tar is teasing me. here's my situation: > > > > I'd like to tar.gz all the /home directories on my machine every > night, into > > separate files (for easy restoration), however there are of course > some > > files that I don't want copied into the tar. Lets use the file > quota.users > > for example. I would like to use the exclude-file option of tar but > here's > > the problem > > > > tar czfX testfile.tar.gz excluded.files /home > > > > with excluded.files simply having the line "home/quota.user" in it > works > > fine, but > > tar czfX testfile.tar.gz excluded.files /home/* > > does not. Nor does it work with an exclude file that says: > > home/quota.user > > quota.user > > *.user > > /home/quota.user > > ./quota.user > > > > Which is giving me grief because my script reads like: > > for i in `ls /home` > > do > > tar czfX /backup-directory-structure/$i.tar.gz excluded.files /home/$i > > done > > > > Now I know that I could simply tell the .sh script to exclude that > file, but > > the proper way to do it would be with tar's exclude option since it > scales > > better. > > > > Ideas? > > John Straiton - ClickCom, Inc. > > jks@clickcom.com - (704)365-9970x101 > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body of the message > > > > end of the original message > > This worked for me: > > $ cat ~/tmp/excluded.files > quota.user > exclude2 > > $ ls -R ~/tmp/home/ > user1 user2 user3 user4 > > /home/casimiro/tmp/home/user1: > include1 quota.user > > /home/casimiro/tmp/home/user2: > include1 include2 quota.user > > /home/casimiro/tmp/home/user3: > include1 include2 > > /home/casimiro/tmp/home/user4: > exclude2 include1 quota.user > > $ for d in `ls ~/tmp/home/` > - do > - tar czvfX /usr/tmp/${d}.tar.gz ~/tmp/excluded.files -C ~/tmp/home/ > $d > - done > user1/ > user1/include1 > user2/ > user2/include1 > user2/include2 > user3/ > user3/include1 > user3/include2 > user4/ > user4/include1 > > Tar excluded quota.user from user1, user2 and user4 and exclude2 from > user4 as > requested. > > Hope this helps. > > Francesco Casadei > -- > You can download my public key from http://digilander.iol.it/fcasadei/ > or retrieve it from a keyserver (pgpkeys.mit.edu, wwwkeys.pgp.net, ...) > > Key fingerprint is: 1671 9A23 ACB4 520A E7EE 00B0 7EC3 375F 164E B17B > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message