Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2001 09:06:57 -1000
From:      Matthew Hunt <mph@astro.caltech.edu>
To:        Drew Tomlinson <drew@mykitchentable.net>
Cc:        questions@FreeBSD.ORG
Subject:   Re: How to Untar Group of Files?
Message-ID:  <20011206090657.A38012@wopr.caltech.edu>
In-Reply-To: <000901c17e88$218fd190$962a6ba5@lc.ca.gov>; from drew@mykitchentable.net on Thu, Dec 06, 2001 at 10:59:28AM -0800
References:  <000901c17e88$218fd190$962a6ba5@lc.ca.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
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

(I find the mix of dashed and non-dashed tar arguments aesthetically
displeasing, so I would say:

for tarfile in $.tar.gz; do tar xzvfC $tarfile /new/dir; done
)

-- 
Matthew Hunt <mph@astro.caltech.edu> * Inertia is a property
http://www.pobox.com/~mph/           * of matter.

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?20011206090657.A38012>