The command result into an error which read as follows:
caution: filename not matched
How do I unzip multiple or many zip files under a Linux/Unix-like system?
Linux or Unix-like system use the unzip command to list, test, or extract files from a ZIP archive, commonly found on MS-DOS systems.
The problem with multiple zip files on Linux
Assuming that you have four file in a /disk2/images/ directory as follows:
Let us verify it with the ls command:
data.zip invoices.zip pictures.zip visit.zip
To unzip all files, enter:
$ unzip *.zip
Archive: data.zip caution: filename not matched: invoices.zip caution: filename not matched: pictures.zip caution: filename not matched: visit.zip
Above error indicate that you used the unzip command wrongly. It means extract invoices.zip, pictures.zip, and visit.zip files from inside the data.zip archive. Your shell expands the command ‘unzip *.zip’ it as follows:
unzip data.zip invoices.zip pictures.zip visit.zip
The solution is pretty simple when you want to unzip the file using the wild card; you have two options as follows.
#1: Unzip Multiple Files Using Single Quote (short version)
The syntax is as follows to unzip multiple files from Linux command line:
Type the following command as follows:
$ cd /disk2/images/
$ unzip '*.zip'
$ ls -l
Note: *.zip is put in between two single quotes so that shell will not recognize it as a wild card character.
#2: Unzip Multiple Files from Linux Command Line Using Shell For Loop (Long Version)
You can also use for loop as follows:
for z in *.zip; do unzip $z; done