Home > Enterprise >  How to unzip all files in directory using shell script?
How to unzip all files in directory using shell script?

Time:11-25

I want to unzipped all the files from the specific directory but dont know how to do it using shell script.

Lgl_Entitiy.txt.zip
Lgl_Entitiy.txt_1.zip
Lgl_Relate.txt.zip
Lgl_Relate.txt_1.zip
Lgl_Name.txt.zip
Lgl_Name.txt_1.zip

CodePudding user response:

Install unzip:

sudo apt install unzip or yum install unzip

Use this in the same directory you want to unzip the files:

unzip ‘*.zip’

If you want to put the uncompressed files in other directory, then use this:

unzip ‘*.zip’ -d /usr/sampleZip/ExampleDir

CodePudding user response:

you can use simple unzip command.

Let me give you an example:

  1. go into the directory where you have the zip files.
cd /home/rexter/test
  1. there are few zip files in this location.
ls

1.zip
2.zip
3.zip
  1. now if you want to unzip them all just type:
unzip '*.zip'

And its done!

  • Related