Date: Thu, 6 Sep 2001 15:59:40 +0200 From: Francesco Casadei <fcasadei@inwind.it> To: jks@clickcom.com Cc: freebsd-questions@freebsd.org Subject: Re: Problem with the Exclude option of tar Message-ID: <20010906155940.A2995@goku.kasby> In-Reply-To: <PHEMIEFOLOKALAMFPIPCAEELCBAA.jsmailing@clickcom.com>; from jsmailing@clickcom.com on Wed, Sep 05, 2001 at 05:55:13PM -0400 References: <PHEMIEFOLOKALAMFPIPCAEELCBAA.jsmailing@clickcom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--sdtB3X0nJg68CQEu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 05, 2001 at 05:55:13PM -0400, John Straiton wrote: > tar is teasing me. here's my situation: >=20 > I'd like to tar.gz all the /home directories on my machine every night, i= nto > 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 >=20 > tar czfX testfile.tar.gz excluded.files /home >=20 > 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 >=20 > 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 >=20 > 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. >=20 > Ideas? > John Straiton - ClickCom, Inc. > jks@clickcom.com - (704)365-9970x101 >=20 >=20 > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message >=20 > 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 --=20 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 --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7l4FLfsM3XxZOsXsRAqhuAJ9uFvyTyn+geXMKYeYwZd3asAqOVwCdH4yz lpRwhZxEOx2GBeFiN8zWDjM= =6hjY -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu-- 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?20010906155940.A2995>