How to unzip files from folder in shell script (ksh)

Poonamol's Avatar, Join Date: Mar 2010
Go4Expert Member
Hi,

I have a folder (C:\shellprg\input\) containing .CSV, .zip, .gz files.
1] I want to find all .zip/.gz files from folder (C:\shellprg\input\).
2] unzip/uncompress files into the same folder (C:\shellprg\input\) through shell script.

I am using below commands for unzip files,
Code:
 
unzip <filename>
gzip -d <filename>
Could you please help me out.
Thanks in advance.
0
jafersalam's Avatar, Join Date: Oct 2013
Newbie Member
You can use the following script to unzip/uncompress the zipped / compressed files

Code:
for zipfile in *.zip
do
          unzip $zipfile
          rm -rf $zipfile
done
try this out