Piping find into tar...

David Demelier demelier.david at gmail.com
Wed May 4 07:40:45 UTC 2011


On 04/05/2011 09:25, Modulok wrote:
> List,
>
> 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
>
> Thanks!
> -Modulok-
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

Hi Modulok,

As Peter said you could try using the xargs command with find. This 
should works as well:

find -E . '.*\.txt$' -print | xargs tar -czf result.tgz
-- 
David Demelier


More information about the freebsd-questions mailing list