LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   un tar all files in dir (http://www.linuxquestions.org/questions/linux-newbie-8/un-tar-all-files-in-dir-159223/)

Longinus 03-17-2004 10:17 PM

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

Axo 03-17-2004 10:32 PM

http://www.linuxquestions.org/questi...hreadid=159206

Longinus 03-17-2004 11:10 PM

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?

rnturn 03-17-2004 11:53 PM

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

Longinus 03-18-2004 12:08 AM

what do all the aga's,acq's aew aho?

what are those?

rnturn 03-18-2004 12:19 AM

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? :-)

Demonbane 03-18-2004 12:33 AM

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



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