Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2001 01:38:20 -0800
From:      Christian Lacunza <celacunza@gmx.net>
To:        j mckitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: getting EXCLUDE to work with tar
Message-ID:  <15023.15372.35405.468136@hp0.pacbell.net>
In-Reply-To: <20010313163906.B344@dogma.freebsd-uk.eu.org>
References:  <20010313163906.B344@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15023.15372.35405.468136>