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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
03-17-2004, 11:17 PM
|
#1
|
Member
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420
Rep:
|
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
|
|
|
03-17-2004, 11:32 PM
|
#2
|
Member
Registered: May 2003
Distribution: Debian
Posts: 153
Rep:
|
|
|
|
03-18-2004, 12:10 AM
|
#3
|
Member
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420
Original Poster
Rep:
|
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?
|
|
|
03-18-2004, 12:53 AM
|
#4
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
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
|
|
|
03-18-2004, 01:08 AM
|
#5
|
Member
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420
Original Poster
Rep:
|
what do all the aga's,acq's aew aho?
what are those?
|
|
|
03-18-2004, 01:19 AM
|
#6
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
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? :-)
|
|
|
03-18-2004, 01:33 AM
|
#7
|
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796
Rep:
|
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 08:29 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|