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
🐧 28 comments so far... add one ↓
|Category||List of Unix and Linux commands|
|Firewall||Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04|
|Network Utilities||dig • host • ip • nmap|
|OpenVPN||CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04|
|Package Manager||apk • apt|
|Processes Management||bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time|
|Searching||grep • whereis • which|
|User Information||groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w|
|WireGuard VPN||Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04|