Unzip All Files In A Directory
The following bash script extracts all zip files in the current directory into new dirs with the filename of the zip file, i.e.:
The following files:
myfile1.zipmyfile2.zip
Will be extracted to:
./myfile1/files..../myfile2/files...
Shell script:
#!/bin/shfor zip in *.zipdo dirname=`echo $zip | sed 's/\.zip$//'` if mkdir "$dirname" then if cd "$dirname" then unzip ../"$zip" cd .. # rm -f $zip # Uncomment to delete the original zip file else echo "Could not unpack $zip - cd failed" fi else echo "Could not unpack $zip - mkdir failed" fidone