Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2001 11:20:02 -0800 (PST)
From:      "Drew Tomlinson" <drew@mykitchentable.net>
To:        <mph@astro.caltech.edu>
Cc:        <drew@mykitchentable.net>, <questions@FreeBSD.ORG>
Subject:   =?iso-8859-1?Q?Re:_How_to_Untar_Group_of_Files=3F?=
Message-ID:  <1766.165.107.42.150.1007666402.squirrel@www.mykitchentable.net>
In-Reply-To: <20011206090657.A38012@wopr.caltech.edu>
References:  <20011206090657.A38012@wopr.caltech.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Matthew Hunt said:
> 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
> )

Thanks!!! I'll try it.

Drew

>
> --
> 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?1766.165.107.42.150.1007666402.squirrel>