1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Unix' started by Poonamol, Oct 1, 2010.

  1. Poonamol

    Poonamol New Member

    Joined:
    Mar 31, 2010
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    0
    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.:confused:
     
  2. jafersalam

    jafersalam New Member

    Joined:
    Oct 7, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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 :)
     

Share This Page