The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleting files after the creation of a tar archive Minguccio75 UNIX for Advanced & Expert Users 5 02-13-2007 02:26 AM
Archive script old files kayarsenal Shell Programming and Scripting 1 08-24-2006 10:46 PM
Archive files kayarsenal Shell Programming and Scripting 13 08-21-2006 08:01 AM
Archive files older than 30days dsravan Shell Programming and Scripting 8 07-26-2006 01:52 PM
script to archive all the log files tintedwindow Shell Programming and Scripting 0 06-13-2006 07:51 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-04-2005
Registered User
 

Join Date: Aug 2005
Posts: 2
tar archive with .Z files

Hello,
I have a tar archive full of compressed .Z (compressed with the compress command) files. I have restored the tar to a disk but am looking for a way to uncompress every file in every sub-directory. Under normal circumstances, I would just change directories and "uncompress *" but with 1600 total directories, I was hoping that there would either be a switch for uncompress that would do all recursive sub-directories or that a tar switch exists that will uncompress upon restore (ie: tar -xvf? ).
I am running this on Kornshell/cshell emulator for XP. (Don't hate me for using M$)
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-04-2005
Registered User
 

Join Date: Aug 2004
Posts: 232
Have you tried using the shell to accomplish what you need.

for example:

foreach i (*/*.Z)
uncompress $i
end



This will descend 1 level into a directory and uncompress the file.
Reply With Quote
  #3 (permalink)  
Old 08-05-2005
Registered User
 

Join Date: Jul 2005
Location: England
Posts: 183
find <dirname> -name \*.Z -exec uncompress {} \;

Where <dirname> is the top level of where all your compressed files are.

If you dont have access to find then its possible to do it quickly using the same basic command for each level of dir present.

uncompress *.Z
uncompress */*.Z
uncompress */*/*.Z
etc ...

Otherwise you need a lslightly awkward shell script to recurse into and uncompress all the files.
Reply With Quote
  #4 (permalink)  
Old 08-05-2005
Registered User
 

Join Date: Aug 2005
Posts: 2
Thanks for the suggestions, still pretty new to this OS, but learning nor every day.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0