LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-17-2004, 11:17 PM   #1
Longinus
Member
 
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Rep: Reputation: 30
Question un tar all files in dir


hi

how would i extract all .tar.gz files in a dir?

i have tried:

tar xzvf *.tar.gz

but that gave me errors

any suggestions?

thanks
 
Old 03-17-2004, 11:32 PM   #2
Axo
Member
 
Registered: May 2003
Distribution: Debian
Posts: 142

Rep: Reputation: 16
http://www.linuxquestions.org/questi...hreadid=159206
 
Old 03-18-2004, 12:10 AM   #3
Longinus
Member
 
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Original Poster
Rep: Reputation: 30
well what i was trying to do was use the * wildcard to extract anything that ends with .tar.gz, but then then i get a few errors

any suggestions?
 
Old 03-18-2004, 12:53 AM   #4
rnturn
Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0), SuSE (10.x, 11.x, 12.2), Solaris (8-10), Tru64
Posts: 961

Rep: Reputation: 51
Quote:
well what i was trying to do was use the +ACo- wildcard to extract anything that ends with .tar.gz
Try:
Code:
for F in +AGA-echo +ACo-.tar.gz+AGA-
do
  tar xzvf +ACQAew-F+AH0-
done
It looks like tar doesn't want to see the wildcard in the argument. (It will, of course, accept as the last argument, as in: tar cvf bighonkin.tar +ACo-)

Good luck...

Rick
 
Old 03-18-2004, 01:08 AM   #5
Longinus
Member
 
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Original Poster
Rep: Reputation: 30
what do all the aga's,acq's aew aho?

what are those?
 
Old 03-18-2004, 01:19 AM   #6
rnturn
Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0), SuSE (10.x, 11.x, 12.2), Solaris (8-10), Tru64
Posts: 961

Rep: Reputation: 51
Quote:
what do all the aga's,acq's aew aho?
OK, I know it's late and I'm not seeing straight, but, what? I have seen some really oddball substitutions get done when I've posted stuff on this forum but at least what I just posted a while ago looks OK on my browser (Mozilla 1.5). Did something get horribly garbled? :-)
 
Old 03-18-2004, 01:33 AM   #7
Demonbane
Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
This should work:
Code:
for foo in *.tar.gz; do tar xvzf $foo; done
Reason why you cant use a wild card is because all the filenames that match the wildcard will be passed to tar as the argument.
So tar xvzf *.tar.gz is equivalent to
Code:
tar xvzf 1.tar.gz 2.tar.gz 3.tar.gz so-on.tar.gz
Which it'll complain because the arguments after 1.tar.gz is suppose to be individual files you want to extract.
What you want to achieve is
Code:
tar xvzf 1.tar.gz
tar xvzf 2.tar.gz
tar xvzf and-so-on.tar.gz
 
  


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
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 12:02 PM
how to install .tar.bz and src.rpms and tar.gz files gadekishore Linux - Software 1 10-12-2005 09:09 PM
Tar files in a dir modified before 7 days in a shell script jayachristina Linux - Newbie 4 05-14-2004 03:49 AM
Bash script (untar *.tar files and then cd to the untared dir) k0ljat Linux - Newbie 2 12-30-2003 06:57 AM
cant install .bin files, tar.gz files or anyother format!!! madskillz Linux - Newbie 4 10-05-2003 11:28 AM


All times are GMT -5. The time now is 10:14 AM.

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