Unzipping the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unzipping the file
# 1  
Old 05-04-2011
Unzipping the file

I have my folder structure like a file a.zip is placed in one folder.
Inside a.zip is two other zip files x.zip and y.zip
If i unzip x.zip i have folder a folder z and inside folder z there are different folders with event time appended to it.
Inside the every event folder ,I have a sub folder which is containing the actual zip files to be unzipped.
Please let me know how the above procedure can be put in shell script.

Thanks in advance
# 2  
Old 05-05-2011
Break it down into simple steps, just like when you're describing your situation:
Code:
#!/bin/bash

unzip a.zip
unzip x.zip
cd z
for i in eventDir* ; do 
  cd $i 
  unzip *.zip
  cd ..
done

If you want to run unzip on all zip files in myRootDir directory structure, in any depth, you could do
Code:
find myRootDir -name "*.zip" -exec unzip {} \;

[/code]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error when unzipping a file with extension .gz

I am trying to unzip a file with name D_R_38957222_20111410.txt.gz using the below command. gunzip D_R_38957222_20111410.txt.gz However, I am getting the following error while using the gunzip command as below... gunzip: D_R_38957222_20111410.txt.gz: invalid compressed data--crc error ... (24 Replies)
Discussion started by: dhruuv369
24 Replies

2. Shell Programming and Scripting

Unzipping .Z file in UNIX

Hi , How can I unzip a .Z file in Unix? Thanks and regards, Anupam (3 Replies)
Discussion started by: Anupam_Halder
3 Replies

3. Shell Programming and Scripting

Checking if file exists and unzipping

Hey, I am new to scripting and was wondering what is wrong with this if statement. I want to check if file exists and the if it does to unzip it. I program it as follows if ; then gunzip *_filename.gz fi Thanks in advance! Please use code tags next time for your code and data. (10 Replies)
Discussion started by: mostarac2487
10 Replies

4. Shell Programming and Scripting

Unzipping a file in Solaris - Issue with xls file

Hi, I have an excel file generated by system in windows. I am zipping it, transfering to unix and unzipping there. But i'm getting below output while unzipping. $ /usr/bin/unzip -a 123.zip -d . Archive: 123.zip inflating: ./123/Index.xls When i copy this unzipped xls file to... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

5. Linux

unzipping file > 2gb

I am not able to unzip file greater then 2gb, Any suggestions how to do that in linux? Regards, Manoj (5 Replies)
Discussion started by: manoj.solaris
5 Replies

6. Shell Programming and Scripting

Unzipping latest zip file by name.

I have these zip files that come in with the same name, but different versions. We'll say: SQL_version2.zip SQL_version3.zip SQL_version2432.zip I was wondering if there is a single command (or even piped command, thus still making it a single command) that will let me unzip the latest... (3 Replies)
Discussion started by: mrwatkin
3 Replies

7. Solaris

Alter zip file without unzipping

I have some zip files. Every file has a "folder/xml file" inside it. Is there any way to change these zip files directly without unzipping them. I want to convert these zip files to "/xml file" (want to move the xml file/s one root up by removing the folder inside it.) Ex: -bash-3.00$ for file... (1 Reply)
Discussion started by: _prasad
1 Replies

8. UNIX for Dummies Questions & Answers

reading a zipped file without unzipping it?

Dear all, I would like to ask how i can read a zipped file (file.gz) without actually unzipping it? i think there is a way to do so but i can't remember it.. can anyone help? thanks in advance.. (1 Reply)
Discussion started by: marwan
1 Replies

9. Shell Programming and Scripting

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it? using grep command.. Bit urgent.. pls..help me (2 Replies)
Discussion started by: senraj01
2 Replies

10. UNIX for Dummies Questions & Answers

unzipping .zip file on HP and Solaris

I am transferring a large .zip file (20 GB) from an NT server to HP-UX and Solaris servers. Originally I tried to use info-zip's unzip, but I found out pretty quickly that it does not support files over 4GB. Any suggestions on how to work around this problem? Different decompression utility?... (9 Replies)
Discussion started by: dangral
9 Replies
Login or Register to Ask a Question