How to unzip a zip file into a folder with the zip file’s name – Bash Script



cd into the directory containing the zip files
Run command
nano run.sh
Add below code to run.sh file
#!/bin/bash
for z in *.zip
do
d=`basename $z .zip`
mkdir $d && unzip $z -d $d
done

Make it executable
chmod +x run.sh
Run it
./run.sh
If you want to delete zip files after unzip, you only need to add
rm -rf $z after mkdir $d && unzip $z -d $d

,

Leave a Reply

Your email address will not be published.