LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-14-2003, 10:17 PM   #1
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Rep: Reputation: 31
tar command will only do one file at a time


I'm trying to untar and ungzip three tar.gz . First I tried the command: tar -fixz *.tar.gz, but I found I needed to rearrange the letters. I ended up with tar -xzf ./*tar.gz . It says the files I want to open are "not found in archive." What does that mean?

(BTW, the tar command works when I try to do just one file.)
 
Old 03-14-2003, 11:51 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
When I use tar, I never use the dash (it's not necessary) and I always use the 'v' option (verbose) mode. So try something like this:

tar xvzf *.tar.gz

If that doesn't work, try doing it specifically for each file. I'd bet one (or more) of them is bad. Then if you're really nosy, you can whip out gzip to test the integrity of the gz file(s) that fail, and maybe even use tar to check the tar archive as well.
 
Old 03-15-2003, 12:37 AM   #3
joesbox
Member
 
Registered: Feb 2003
Location: hampton va
Distribution: ubuntu
Posts: 502

Rep: Reputation: 30
i have run into something like this.
i had to gunzip the files first then untar them. don't know how to get past the multi file prob but maybe if you try this
(after gunzip)
tar -xvf filename.tar filename.tar

now i don't know if this will work or not i have never tried it.
 
Old 03-15-2003, 01:00 AM   #4
Freestone
Member
 
Registered: Jan 2003
Location: Brighton, Michigan
Distribution: FC5
Posts: 114

Rep: Reputation: 15
Try the following:


tar -cvf - files | (cd target directory ; tar xpf -)

This will copy the file to a the new directory in an uncompressed state.

Good luck,

Freestone
 
Old 03-15-2003, 07:27 AM   #5
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: fedora, slackware, suse
Posts: 447

Rep: Reputation: 31
If you type tar --help, at the begining you will see the following:
Quote:
GNU `tar' saves many files together into a single tape or disk archive, and
can restore individual files from the archive.

Usage: tar [OPTION]... [FILE]...

Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.
Note that there is one (and only one) option to f which specifies the file (device or whatever) to be processed. Note the the [FILE] has a trailing ... That means you can restore(write) many files.

Try the following:
"echo tar -xzf ./*tar.gz"

You will get something like:
tar -xzf ./tarfile1.tar.gz ./tarfile2.tar.gz ./tarfile3.tar.gz

This means you are telling tar to extract the files ./tarfile2.tar.gz ./tarfile3.tar.gz from the file ./tarfile1.tar.gz. This is why it says .the files are "not found in archive."

If you want to do all the tarfiles at once, try the following:

"for file in *.gz; do tar -xzf $file; done"

Of course, you may want to try the following first: so you can see what would happen

"for file in *.gz; do echo tar -xzf $file; done"

Last edited by fsbooks; 03-15-2003 at 07:28 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 10 02-23-2008 05:40 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM
I need to know the command on how to install tar.bin file lakbay_taodev Linux - Software 9 10-19-2004 06:46 PM
long listing using ls -l command display year or time of the file mnd_world Linux - Newbie 1 05-20-2004 11:39 AM
tar command : error: file changed as we read it sneezesnoeze Linux - General 2 04-05-2004 06:56 PM


All times are GMT -5. The time now is 10:58 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration