Date: Sun, 3 Jan 1999 02:45:24 -0500 (EST) From: "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com> To: jahanur@jjsoft.com (jahanur) Cc: freebsd-questions@FreeBSD.ORG Subject: Re: How do I untar multiple *.tar files? Message-ID: <199901030745.CAA27266@cc942873-a.ewndsr1.nj.home.com> In-Reply-To: <Pine.BSF.3.96.990102234350.7791A-100000@runner.jjsoft.com> from jahanur at "Jan 2, 99 11:55:07 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901030745.CAA27266>