[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Excluding a directory from tar



On Mon, 13 Apr 2015 12:12:51 -0500
David Wright <deblis@lionunicorn.co.uk> wrote:

> Quoting Petter Adsen (petter@synth.no):
> > I've been trying to make a tarball of my home directory, but I want
> > to exclude ~/.cache. First I tried '--exclude="~/.cache", but it
> > didn't work. Neither did '--exclude="~/.cache/*".
> > 
> > I got it working by creating an empty file in ~/.cache and using the
> > filename as an argument to "--exclude-tag-under", but what was I
> > doing wrong when trying to use "--exclude"?
> 
> I didn't know tar did that. I thought most people use find to generate
> the filenames for tar to act on.
> 
> Then you'd be using a command something like
> 
> find -xdev -path './cache' -prune -o -print | tar ...
> 
> and the other advantage of this method is that you pipe it into less
> until you get the files you want, then only then substitute tar.
> 
> Have fun reading man find, though!

petter@monster:~$ man tar | wc -l
540
petter@monster:~$ man find | wc -l
1572

:-)

Petter

-- 
"I'm ionized"
"Are you sure?"
"I'm positive."

Attachment: pgp83Ax0uTVBl.pgp
Description: OpenPGP digital signature


Reply to: