LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-05-2005, 05:04 PM   #1
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Rep: Reputation: 30
untar a list of tar files?


How do I untar a list of tar files? I tried:

tar xvf ./*.tar

I get a bunch of

"Not found in archive" messages, and nothing untars.
 
Old 11-05-2005, 05:08 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
cd into the folder you have stoed them and do tar zxvf *.tar.gz or tar xf *.tar and all should work.
 
Old 11-05-2005, 05:10 PM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Tar takes at most one tar file and interprets all other arguments as file to extract from that archive -- try something like:

Code:
find . -maxdepth 1 -name "*.tar" -exec tar xvf {} \;
edit: typo in find command.

Last edited by btmiller; 11-05-2005 at 05:13 PM.
 
Old 11-05-2005, 05:11 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
That won't work as it would try to extract the remaining tarballs from the first one.
You can do this instead:
Code:
for i in *.tar
do
tar xf "$i"
done
 
Old 11-05-2005, 05:12 PM   #5
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 356

Rep: Reputation: 43
Code:
find . -name "*.tar" -exec tar xvf {} \;
edit: looks like I was too late

Last edited by TBC Cosmo; 11-05-2005 at 05:15 PM.
 
Old 11-05-2005, 05:21 PM   #6
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
I love this site, I get three different solutions, in 8 minutes, any one of which will work. Thanks,

rw

EDIT: Well, tar xf *.tar doesn't work, but still.

Last edited by Rotwang; 11-05-2005 at 05:23 PM.
 
Old 10-10-2006, 02:34 PM   #7
ajays
LQ Newbie
 
Registered: Jul 2003
Posts: 2

Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by jlliagre
That won't work as it would try to extract the remaining tarballs from the first one.
You can do this instead:
Code:
for i in *.tar
do
tar xf "$i"
done
that worked for me
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to untar all tar-files in a directory? zoomzoom Linux - Newbie 13 05-09-2017 12:52 PM
Whats the command to untar files that end in .tar.bz2? BaZiL Linux - Newbie 3 06-20-2007 11:51 AM
How to list the files in my tar.bz2 archive ??? merlin23 Linux - Newbie 13 12-14-2004 09:50 AM
list files in a tar.gz file linuxtesting2 Linux - Newbie 4 09-23-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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:38 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration