Tips on Linux

How to unzip all 7z files in a directory?

One can use the following bash script to unzip all *.7z files in a directory.

#!/bin/bash
FILES=$1/*.7z
shopt -s nullglob
for f in $FILES
do
    echo "Processing $f file ..."
    7za x $f -o$2
done

Save the script as unzipAll.sh.

$ chmod +x unzipAll.sh
$ ./unzipAll.sh /path/to/7z/file/directory /path/to/target/directory</pre>
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *