From owner-freebsd-questions Fri Dec 7 4:27:58 2001 Delivered-To: freebsd-questions@freebsd.org Received: from blacklamb.mykitchentable.net (ekgr-dsl2-77.citlink.net [207.173.226.77]) by hub.freebsd.org (Postfix) with ESMTP id 4C50437B416 for ; Fri, 7 Dec 2001 04:27:51 -0800 (PST) Received: from tagalong (unknown [192.168.1.12]) by blacklamb.mykitchentable.net (Postfix) with SMTP id EC778EE66B; Fri, 7 Dec 2001 04:29:23 -0800 (PST) Message-ID: <002f01c17f1a$92afda40$0c01a8c0@lc.ca.gov> From: "Drew Tomlinson" To: "Jan Grant" Cc: "questions" References: Subject: Re: How to Untar Group of Files? Date: Fri, 7 Dec 2001 04:27:44 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 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 ----- Original Message ----- From: "Jan Grant" To: "Matthew Hunt" Cc: "Drew Tomlinson" ; "questions" Sent: Friday, December 07, 2001 3:53 AM Subject: Re: How to Untar Group of Files? > 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 This is part of what I love about *nix; there's so many different ways to accomplish a task. Thank you for the additional perspective. I have just enough experience with the OS (about 10 months) to understand the power but not enough to know how to use it properly. In the past, I would just do them one at a time until I was done but now I'm forcing myself to learn how to do it right. And because I'm learning, I appreciate seeing the different ways available to do things. Thanks, Drew > > -- > 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