Linux under unzip command how to extract multiple file details
- 2020-11-20 06:23:44
- OfStack
There is no unzip command resolution indicated in linux
If you are using the unzip command to unzip the.zip file, you may not have the unzip software installed. Here is how to install it
Command:
yum list | grep zip/unzip
# Gets the installation list
Installation command:
yum install zip
# When prompted for input, enter y;
Installation command:
yum install unzip
# When prompted for input, enter y;
Using unzip *.zip to unzip multiple files directly under Linux will report an error
You can use
unzip '*.zip'
or
unzip "*.zip"
or
unzip \*.zip
The command
Or use
for z in *.zip; do unzip $z; done
Perform decompression
You can see below that there are 6 zip zip files in the current directory
[root@autoServer COLLECTION]# ll -s
total 24
4 -rw-r--r--. 1 root root 1681 Sep 11 15:38 00004.zip
4 -rw-r--r--. 1 root root 1325 Sep 11 15:38 00005.zip
4 -rw-r--r--. 1 root root 1540 Sep 11 15:43 00010.zip
4 -rw-r--r--. 1 root root 1392 Sep 11 15:43 00011.zip
4 -rw-r--r--. 1 root root 1541 Sep 11 15:48 00016.zip
4 -rw-r--r--. 1 root root 1390 Sep 11 15:48 00017.zip
use
unzip \*.zip
Command to unzip, you can see that 6 files have been successfully unzipped
[root@autoServer COLLECTION]# unzip \*.zip
Archive: 00005.zip
inflating: GAB_ZIP_INDEX.xml
inflating: 15366516000003-BASIC_1004.bcp
Archive: 00010.zip
replace GAB_ZIP_INDEX.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: n
inflating: 15366518460006-SOURCE_1001.bcp
Archive: 00016.zip
replace GAB_ZIP_INDEX.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: GAB_ZIP_INDEX.xml
inflating: 15366519060012-SOURCE_1001.bcp
Archive: 00017.zip
inflating: GAB_ZIP_INDEX.xml
inflating: 15366519080014-SOURCE_1002.bcp
Archive: 00004.zip
inflating: GAB_ZIP_INDEX.xml
inflating: 15366516000001-BASIC_1003.bcp
Archive: 00011.zip
inflating: GAB_ZIP_INDEX.xml
inflating: 15366518480008-SOURCE_1002.bcp
6 archives were successfully processed.
Look at the current directory where you have the unzipped files
[root@autoServer COLLECTION]# ll -s
total 52
4 -rw-r--r--. 1 root root 294 Sep 11 15:40 15366516000001-BASIC_1003.bcp
4 -rw-r--r--. 1 root root 158 Sep 11 15:40 15366516000003-BASIC_1004.bcp
4 -rw-r--r--. 1 root root 104 Sep 11 15:45 15366518460006-SOURCE_1001.bcp
4 -rw-r--r--. 1 root root 80 Sep 11 15:45 15366518480008-SOURCE_1002.bcp
4 -rw-r--r--. 1 root root 104 Sep 11 15:50 15366519060012-SOURCE_1001.bcp
4 -rw-r--r--. 1 root root 80 Sep 11 15:50 15366519080014-SOURCE_1002.bcp
4 -rw-r--r--. 1 root root 1681 Sep 11 15:38 00004.zip
4 -rw-r--r--. 1 root root 1325 Sep 11 15:38 00005.zip
4 -rw-r--r--. 1 root root 1540 Sep 11 15:43 00010.zip
4 -rw-r--r--. 1 root root 1392 Sep 11 15:43 00011.zip
4 -rw-r--r--. 1 root root 1541 Sep 11 15:48 00016.zip
4 -rw-r--r--. 1 root root 1390 Sep 11 15:48 00017.zip
4 -rw-r--r--. 1 root root 2056 Sep 11 15:45 GAB_ZIP_INDEX.xml
unzip USES supplementary commands
Unzip the file to the current directory
unzip test.zip
To extract the file to the specified directory, the -d parameter is used
unzip -d /temp test.zip
The existing file is not overwritten after decompression, using the -ES63en parameter; To decompress in overlay mode, use the -ES64en parameter
unzip -n test.zip
unzip -n -d /temp test.zip
Unzip the compressed file test.zip in the specified directory tmp. If the same file already exists, overwrite the original file with -ES72en
unzip -o test.zip -d /tmp/
Just look at what subfiles are contained in the zip zip but do not unzip, using the -ES78en parameter
unzip -l test.zip
View the list of files displayed also contains the compression ratio, using the -ES83en parameter
unzip -v test.zip
Check for damage to the zip file using the -ES89en parameter
unzip -t test.zip
conclusion