Date: Fri, 7 Dec 2001 11:53:32 +0000 (GMT) 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> Subject: Re: How to Untar Group of Files? Message-ID: <Pine.GSO.4.31.0112071152180.11244-100000@mail.ilrt.bris.ac.uk> In-Reply-To: <20011206090657.A38012@wopr.caltech.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.31.0112071152180.11244-100000>