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-20-2012, 11:01 PM   #1
mayurirao
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Gunzip multiple files from different directories


Hello,

I am new to linux. I need to gunzip many files distributed over different directories. I have made a path.txt file containing the paths of all these .gz files. How can I apply gunzip to them in one go?

- Thanks
 
Old 03-20-2012, 11:10 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Code:
while read file; do
  gunzip "$file"
done < path.txt
The files will be replaced with *.gz compressed versions. Is that what you want?

Why not create a tar archive of the files, using gzip compression?
 
Old 03-20-2012, 11:19 PM   #3
mayurirao
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi

Thanks for the reply. I want to uncompress the files. So the path.txt file contains the paths of the compressed files. Should I use the same commands you suggested?
 
Old 03-20-2012, 11:29 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
I think jschiwal just mixed up gzip and gunzip, it should work exactly like you want.
 
Old 03-20-2012, 11:38 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Sorry. The original .gz files will be replaced with the uncompressed originals. I was still thinking about a related question on compression.

Last edited by jschiwal; 03-20-2012 at 11:40 PM.
 
Old 03-20-2012, 11:47 PM   #6
mayurirao
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks. If I want to list the paths of these uncompressed files in yet another .txt file what should I do?
 
  


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
Creating a script to move or copy files into multiple directories below the files matthes138 Linux - Newbie 5 08-25-2009 05:57 PM
cp multiple files to multiple directories Heksie Linux - Newbie 2 02-05-2009 06:17 AM
List all files in multiple directories haiders Linux - Newbie 6 05-10-2007 01:05 PM
Change text in multiple files in multiple directories vivo2341 Linux - General 5 11-27-2006 09:16 PM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 06:25 PM


All times are GMT -5. The time now is 08:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration