Date: Fri, 7 Dec 2001 04:27:44 -0800 From: "Drew Tomlinson" <drew@mykitchentable.net> To: "Jan Grant" <Jan.Grant@bristol.ac.uk> Cc: "questions" <questions@FreeBSD.ORG> Subject: Re: How to Untar Group of Files? Message-ID: <002f01c17f1a$92afda40$0c01a8c0@lc.ca.gov> References: <Pine.GSO.4.31.0112071152180.11244-100000@mail.ilrt.bris.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
----- Original Message ----- From: "Jan Grant" <Jan.Grant@bristol.ac.uk> To: "Matthew Hunt" <mph@astro.caltech.edu> Cc: "Drew Tomlinson" <drew@mykitchentable.net>; "questions" <questions@FreeBSD.ORG> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002f01c17f1a$92afda40$0c01a8c0>