unzip解壓失敗( cannot find zipfile directory)


本文鏈接:https://blog.csdn.net/yori_chen/article/details/80493383
[root@localhost soft]# unzip QY.zip
Archive: QY.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of QY.zip or
QY.zip.zip, and cannot find QY.zip.ZIP, period.
1
2
3
4
5
6
7
8
剛開始以為是壓縮包文件部分信息丟失,導致解壓出錯了,不應該呀,怎么會出錯呢,,emmmm,還是感覺不對勁,於是Google了下:

一般在linux下解壓zip文件,直接用系統默認的extract here進行解壓(默認使用的是 unzip)
如果壓縮文件.zip是大於2G的,那unzip就無法使用了,這是由於C庫中long類型數據所能表示的文件偏移在32位機子上只能有2G
所以如果要解壓大文件,可以使用7zip來解壓
安裝7zip
官網地址:http://www.7-zip.org/download.html
軟件下載地址:https://sourceforge.net/projects/p7zip/files/p7zip/

這里使用16.02版本進行安裝,linux環境

wget https://jaist.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2
tar -jxvf p7zip_16.02_src_all.tar.bz2
cd p7zip_16.02
make && make install
1
2
3
4
如果執行make命令時,提示安裝g++的話,請執行 yum install gcc-c++

出現 tar (child): bzip2: Cannot exec: No such file or directory,請安裝yum install bzip2 -y

出現以下信息,即為安裝完畢

./install.sh /usr/local/bin /usr/local/lib/p7zip /usr/local/man /usr/local/share/doc/p7zip
- installing /usr/local/bin/7za
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOC

1
2
3
4
5
6
7
8
9
7z命令的使用
解壓縮7z文件
7za x test.zip -r -o./
1
參數含義:

x 代表解壓縮文件,並且是按原始目錄樹解壓(還有個參數 e 也是解壓縮文件,但其會將所有文件都解壓到根下,而不是自己原有的文件夾下)
test.zip 是當前目錄下的壓縮文件,這里用做測試文件
-r 表示遞歸解壓縮所有的子文件夾
-o 是指定解壓到的目錄,-o后是沒有空格的,直接接目錄(-o./ 為當前目錄)
壓縮文件/文件夾
7za a -t7z -r test.7z /opt/test/*
1
參數含義:

a 代表添加文件/文件夾到壓縮包
-t 是指定壓縮類型,這里定為7z,可不指定,因為7za默認壓縮類型就是7z
-r 表示遞歸所有的子文件夾
test.7z 是壓縮好后的壓縮包名
/opt/test/* 是壓縮目錄
注意:7za不僅僅支持.7z壓縮格式,還支持.zip.、tar、.bz2等壓縮類型


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM