From owner-freebsd-questions@FreeBSD.ORG Wed May 4 08:11:04 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 301C4106566B for ; Wed, 4 May 2011 08:11:04 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id AC56E8FC16 for ; Wed, 4 May 2011 08:11:03 +0000 (UTC) Received: by bwz12 with SMTP id 12so1103906bwz.13 for ; Wed, 04 May 2011 01:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=bfVg6YpMAmo3NfLsa0hKKySz7yaQZeyyAP+F/bvU6AA=; b=wC8d+OFZmuu+qi8yhKNZOql0a3iqs+GW24ESpiJC5cA3yYkCkJPbYo8eWRFl91MtWq zs4HFyHaHmqcC/NS4FNDJjqpg7E2f/0eTG9U/tdjj2UDjcqLPWv77WtuXMfdyOR9dxck UnvzzqYaiUxaDMmE6HXA/Yzp9w9Kyzq+9Bp/w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; b=W0bd8pAlKQx3DUN1OL5vTq/Y4u+Frf9pSA2WB/hYp7izyjOoIM5vIwVRoRozHZ+PY2 AYGjxoxVvpIhgtFwL5x2ejOumImYcybZDGHc0b3/falemCVTxHoGzD7FFsWSV1FlPEYq +BIUtytIE1JGoqvkj7UVRC9h+htB4ufFyd52Y= Received: by 10.204.181.7 with SMTP id bw7mr756469bkb.16.1304496662419; Wed, 04 May 2011 01:11:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.42.21 with HTTP; Wed, 4 May 2011 01:06:56 -0700 (PDT) In-Reply-To: References: From: Chris Rees Date: Wed, 4 May 2011 09:06:56 +0100 Message-ID: To: bf1783@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org, Modulok Subject: Re: Piping find into tar... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: utisoft@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2011 08:11:04 -0000 On 4 May 2011 08:44, b. f. wrote: >> 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. How about using pax? find . -depth -print | pax -wd | gzip > archive.tgz or find . -depth -print | pax -wd | bzip2 > archive.tbz By the way, in reference to the commands above the -j option is for bzip2, so the extension should be .tbz o_O Chris