Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2011 15:24:58 +0100
From:      Chris Rees <utisoft@gmail.com>
To:        freebsd-questions@freebsd.org
Cc:        kron24 <kron24@gmail.com>, Modulok <modulok@gmail.com>
Subject:   Re: Piping find into tar...
Message-ID:  <BANLkTimDAirH773b3caD4uOPenWwm+jZ=w@mail.gmail.com>
In-Reply-To: <44r58ey4xl.fsf@lowell-desk.lan>
References:  <BANLkTi=-90CJk41um5A3J-iSEVUCv1Viqg@mail.gmail.com> <BANLkTikxNouAi7SQ0xEEK+jGFZzRH=r3TQ@mail.gmail.com> <BANLkTike2NRiY33p1epo0hiz_SbgvGma6g@mail.gmail.com> <BANLkTikuSZLCJ4tbvqnJ22_PYZ8=DnEE=w@mail.gmail.com> <4DC13794.6010004@gmail.com> <44r58ey4xl.fsf@lowell-desk.lan>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 4 May 2011 14:25, "Lowell Gilbert" <
freebsd-questions-local@be-well.ilk.org> wrote:
>
> kron24 <kron24@gmail.com> writes:
>
> > Dne 4.5.2011 11:42, Modulok napsal(a):
> >>>> By the way, in reference to the commands above the -j option is for
> >> bzip2, so the extension should be .tbz o_O
> >>
> >> Thanks everyone! I went with the following, because it works regardless
of
> >> space characters in filenames. (Thanks for the correction on the
extenion. It
> >> should indeed be 'tbz' when using the 'j' flag.)
> >>
> >> find -E . -regex '.*\.txt$' -print0 | xargs -0 tar -cjf result.tbz
> >
> > When the amount of files is huge then tar will be invoked twice
> > or more. Thus result.tbz will contain just files from the last
invocation.
>
> Yes, xargs isn't part of the solution for this case unless you use the
> update mode to tar, which will be much slower.  However, tar can read
> the file list from a file, which can be stdin if you want.  The
> equivalent of the above command would be something like:
>
> find -E . -regex '.*\.txt$' -print0 | tar --null -T - -cjf result.tbz
>
> > I consider cpio a better option here.
>
> The old ways still work very well.
>
> But it's worth noting that on FreeBSD these days, cpio(1) and tar(1) are
> both implemented on the same library, so there are very few things that
> one can do but the other cannot.
>

Why on Earth are people still fooling about contorting tar into weird
shapes????

The great thing about pax is It's a drop in replacement for cpio that makes
tar archives; It's designed to be used with find!

Chris



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?BANLkTimDAirH773b3caD4uOPenWwm+jZ=w>