Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 May 2011 03:44:45 -0400
From:      "b. f." <bf1783@googlemail.com>
To:        Modulok <modulok@gmail.com>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: Piping find into tar...
Message-ID:  <BANLkTi=-90CJk41um5A3J-iSEVUCv1Viqg@mail.gmail.com>

Next in thread | Raw E-Mail | Index | Archive | Help
> I've been playing with the find command lately. Is there a way I can pipe the
> putput list of files from find, into the tar command to create an archive which
> contains the files which find lists? I tried the following, but it didn't work
> (obviously).
>
> find -E . '.*\.txt$' -print | tar -cjf result.tgz

You could use something like:

find -X . -name '*.txt' | xargs tar -cjf result.tgz

or

find . -name '*.txt' -print0 | xargs -0 tar -cjf result.tgz

b.



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?BANLkTi=-90CJk41um5A3J-iSEVUCv1Viqg>