This is a nice bash one liner using default unzip:
while read -r line; do (unzip -d "$(basename "$line" .zip)" "$line"); done < <(find . | grep '.zip')
Run this in the directory that has the zip files for unzipping.
- The
< <feeds the results of thefind . | grep '.zip'into thewhileloop. - The filenames returned by
findare then stored asline - The
whileloop iterates over the file names inlineand feeds them into thedo - This
docreates a directory using thebasenameof the filename from$line- The
.zipextension is specified as the text to be stripped off the string - This leaves only the name of the file without an extension (basename!)
- The
- The
-dargument uses the basename of the.zipto create the new directory/folder/archive.zipthen becomes/folder/archive/unzipped_file.txtetc.- This is a lot like Windows / 7zip "extract all"to" option
- The
$linevariable is then used as the target to unzip.
This one liner can be adapted for all kinds of things too! Moving files, zipping them, copying them... Find is recursive so it's super handy!