Date: Thu, 6 Sep 2001 16:46:07 -0400 From: "John Straiton" <jsmailing@clickcom.com> To: "Francesco Casadei" <fcasadei@inwind.it>, <freebsd-questions@freebsd.org> Subject: RE: Problem with the Exclude option of tar Message-ID: <PHEMIEFOLOKALAMFPIPCKEFECBAA.jsmailing@clickcom.com> In-Reply-To: <20010906155940.A2995@goku.kasby>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?PHEMIEFOLOKALAMFPIPCKEFECBAA.jsmailing>