From owner-freebsd-questions Fri Dec 7 3:56:31 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dire.bris.ac.uk (dire.bris.ac.uk [137.222.10.60]) by hub.freebsd.org (Postfix) with ESMTP id F342637B41B for ; Fri, 7 Dec 2001 03:56:24 -0800 (PST) Received: from mail.ilrt.bris.ac.uk by dire.bris.ac.uk with SMTP-PRIV with ESMTP; Fri, 7 Dec 2001 11:56:11 +0000 Received: from cmjg (helo=localhost) by mail.ilrt.bris.ac.uk with local-esmtp (Exim 3.16 #1) id 16CJZM-0003UD-00; Fri, 07 Dec 2001 11:53:32 +0000 Date: Fri, 7 Dec 2001 11:53:32 +0000 (GMT) From: Jan Grant X-X-Sender: To: Matthew Hunt Cc: Drew Tomlinson , questions Subject: Re: How to Untar Group of Files? In-Reply-To: <20011206090657.A38012@wopr.caltech.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 6 Dec 2001, Matthew Hunt wrote: > On Thu, Dec 06, 2001 at 10:59:28AM -0800, Drew Tomlinson wrote: > > > I have a directory with several *.tar.gz files that I want to untar to > > another directory. I tested my command "tar xfvz file.tar.gz -C > > /new/dir" and it worked OK. Next I tried "tar xfvz * -C /new/dir" but > > received errors like this: > > > > tar: file1.tar.gz not found in archive > > tar: file2.tar.gz not found in archive > > tar: file3.tar.gz not found in archive > > tar: file4.tar.gz not found in archive > > Right, tar can take the name of exactly one archive, and multiple > files to be found therein. It can't take multiple archive names. > > > How should I structure my command to untar all the files at once? > > Use your shell's looping constructs; in sh or similar (non-csh) > shells, something like: > > for tarfile in $.tar.gz; do tar xfvz $tarfile -C /new/dir; done Alternatively, echo *.tar.gz | xargs -n1 tar -C /new/dir zxvf -- jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/ Tel +44(0)117 9287088 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk Bolstered by my success with vi, I proceeded to learn C with 'learn c'. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message