Linux下使用unzip命令解壓多個檔案
Linux下直接使用unzip *.zip解壓多個檔案會報錯
可以使用unzip '*.zip'
或者unzip "*.zip"
或者unzip \*.zip
命令
或者使用for z in *.zip; do unzip $z; done
執行解壓
- 如下可以看到當前目錄下有6個zip檔案
[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
-
使用
unzip \*.zip
命令進行解壓,可以看到6個檔案都解壓成功了
[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.
- 再檢視當前目錄已經有了解壓後的檔案
[root@autoServer COLLECTION]# ll -s total 52 4 -rw-r--r--. 1 root root294 Sep 11 15:40 15366516000001-BASIC_1003.bcp 4 -rw-r--r--. 1 root root158 Sep 11 15:40 15366516000003-BASIC_1004.bcp 4 -rw-r--r--. 1 root root104 Sep 11 15:45 15366518460006-SOURCE_1001.bcp 4 -rw-r--r--. 1 root root80 Sep 11 15:45 15366518480008-SOURCE_1002.bcp 4 -rw-r--r--. 1 root root104 Sep 11 15:50 15366519060012-SOURCE_1001.bcp 4 -rw-r--r--. 1 root root80 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
參考博文ofollow,noindex">https://blog.csdn.net/jaye16/article/details/74978408