From owner-freebsd-questions Thu Dec 6 11: 7: 6 2001 Delivered-To: freebsd-questions@freebsd.org Received: from wopr.caltech.edu (wopr.caltech.edu [131.215.102.114]) by hub.freebsd.org (Postfix) with ESMTP id 6186037B405 for ; Thu, 6 Dec 2001 11:07:02 -0800 (PST) Received: (from mph@localhost) by wopr.caltech.edu (8.11.6/8.9.3) id fB6J6vx38432; Thu, 6 Dec 2001 11:06:57 -0800 (PST) (envelope-from mph) Date: Thu, 6 Dec 2001 09:06:57 -1000 From: Matthew Hunt To: Drew Tomlinson Cc: questions@FreeBSD.ORG Subject: Re: How to Untar Group of Files? Message-ID: <20011206090657.A38012@wopr.caltech.edu> References: <000901c17e88$218fd190$962a6ba5@lc.ca.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <000901c17e88$218fd190$962a6ba5@lc.ca.gov>; from drew@mykitchentable.net on Thu, Dec 06, 2001 at 10:59:28AM -0800 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 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 * 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