From owner-freebsd-questions Sat Jan 2 23:46:42 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA25318 for freebsd-questions-outgoing; Sat, 2 Jan 1999 23:46:42 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA25313 for ; Sat, 2 Jan 1999 23:46:40 -0800 (PST) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.8.8/8.8.8) id CAA27266; Sun, 3 Jan 1999 02:45:24 -0500 (EST) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199901030745.CAA27266@cc942873-a.ewndsr1.nj.home.com> Subject: Re: How do I untar multiple *.tar files? In-Reply-To: from jahanur at "Jan 2, 99 11:55:07 pm" To: jahanur@jjsoft.com (jahanur) Date: Sun, 3 Jan 1999 02:45:24 -0500 (EST) Cc: freebsd-questions@FreeBSD.ORG Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG jahanur wrote, > Hi Everybody, > I am new to Unix. > > Is there any command to untar a lot of *.tar files at one command. > > I have tried doing #tar xv *.* /cdrom/dir/ > > It does not work. Please help! The command you are typing does the following, 1) The shell (the command line interpreter) substitutes in all of the files in the present working directory that match the '*.*' pattern. 2) That list of files, begining with 'xv' and ending with '/cdrom/dir,' are passed to the 'tar' command. 3) The 'tar' command interprets the 'xv' as asking it to extract verbosely. 4) Since there is no 'f' option given to the 'tar' command, IT WILL CHECK FOR THE ARCHIVE ON THE DEFAULT DEVICE (/dev/rst0). When it does not find that device it working order, it will probably fail here. However, if it finds it, it would continue... 5) It will interpret all of the following arguments as names of files in the archive to be extracted. This is probably not what you want it to do. There is not an effective way to do 'a lot of *.tar files at once' using the 'tar' command alone. This is due to its history of reading off of a tape. To do many tar archives at once, you will need to use looping structures in your favorite shell. But since you are new to UNIX, I assume you don't have a favorite yet. Here's how you would extract all of the tarballs in the /cdrom/dir/ directory to the present working directory in C Shell (csh) interactively, % foreach tarball ( /cdrom/dir/*.tar ) ? tar xvf $tarball ? end Now, if you have special locations for different tar extracts, your command will become more and more complex. If you have enough, you might want to just do them one at a time. HTH. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message