Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


Closed Thread
  Search this Thread
Old 02-12-2006, 08:02 AM   #1
Registered: Mar 2004
Posts: 48

Rep: Reputation: 15
Lightbulb un-TARring a bunch of files at once

Hi all,
I hope this is a simple question, but I have searched high and low and haven't found an answer. Is there a way to un-tar a bunch of tar.gz files at one time in a directory? I have about 500 tar.gz files that I want to untar, but it will only let me do it one file at a time (from the command line) e.g. if I tar -xzvf *.tar.gz, it just tells me that blah blah blah is not found in the archive. Any suggestions? the man page was no help.
Thanks in advance,
Old 02-12-2006, 08:21 AM   #2
Registered: Feb 2006
Distribution: FC
Posts: 86

Rep: Reputation: 15
Hi Jeff,

The problem with your command is that "*.tar.gz" gets expanded in the shell before it's fed to the tar command. So it sees the first .tar.gz file as the actual file and the rest as parameters to search for within the aforementioned first .tar.gz.

Try this out instead: for i in *.tar.gz; do tar -xvzf "$i"; done;

Old 02-12-2006, 09:18 AM   #3
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

Closed Thread

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
Delete a bunch of files with "find" chess Slackware 3 01-28-2006 12:08 PM
Need to chown a bunch of remote files. Kbear? $ftp? asktoby Linux - Software 0 12-06-2004 10:27 AM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 05:25 PM
Need helpThis script erased a bunch of my files HELP VisionZ Linux - Newbie 12 03-25-2004 10:02 AM
un-tarring multiple files phil1076 Linux - General 19 12-18-2003 02:03 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:09 PM.

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