From owner-freebsd-questions Wed Mar 14 1:37:45 2001 Delivered-To: freebsd-questions@freebsd.org Received: from hp0.pacbell.net (adsl-64-161-130-84.dsl.snfc21.pacbell.net [64.161.130.84]) by hub.freebsd.org (Postfix) with ESMTP id 8ADE837B71A for ; Wed, 14 Mar 2001 01:37:41 -0800 (PST) (envelope-from celacunza@gmx.net) Received: (from lacunza@localhost) by hp0.pacbell.net (8.11.1/8.11.1) id f2E9cKO55776; Wed, 14 Mar 2001 01:38:20 -0800 (PST) (envelope-from celacunza@gmx.net) From: Christian Lacunza MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15023.15372.35405.468136@hp0.pacbell.net> Date: Wed, 14 Mar 2001 01:38:20 -0800 To: j mckitrick Subject: Re: getting EXCLUDE to work with tar Cc: freebsd-questions@freebsd.org In-Reply-To: <20010313163906.B344@dogma.freebsd-uk.eu.org> References: <20010313163906.B344@dogma.freebsd-uk.eu.org> X-Mailer: VM 6.90 under Emacs 20.7.1 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Hi all, > > I am tring to avoid backing up all of my browser files and such when I do a > backup. But -X excludefile doesn't seem to work. In this file, I have > > ~/netscape/cache > ~/netscape/nmmail > etc > > and I have also tried these entries with terminating '/' and even '/*' but > these directories keep getting tar'ed. What am I doing wrong? > > > jm hi jonathon. apparently tar doesn't understands tildes or asterisks. it just checks each file it comes across to see if the file's pathname (as printed by "tar tf file.tar") matches any of the strings in the exclude file. try an exclude file like this: lacunza/.netscape/cache lacunza/nsmail ... then you can run tar like this (from any directory) $ tar cfX /usr/tmp/backup.tar ~/exclude-file ~ tar: Removing leading / from absolute path names in the archive. $ tar tf /usr/tmp/tarball.tar usr/home/lacunza/ usr/home/lacunza/.cshrc usr/home/lacunza/.login usr/home/lacunza/.login_conf usr/home/lacunza/.mailrc ... and you'll see that any pathname containing "lacunza/.netscape/cache" has been excluded. you could also do it like this $ cd ~/.. $ tar cfX /usr/tmp/backup.tar ~/exclude-file ./lacunza $ tar tf /usr/tmp/tarball.tar ./lacunza/ ./lacunza/.cshrc ./lacunza/.login ./lacunza/.login_conf ./lacunza/.mailrc ... which is what i prefer. -- christian. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message