[Linux] Unzip decompression failed (cannot find zipfile directory)

[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.


At first I thought that part of the information in the compressed file was lost, which caused an error in the decompression. It shouldn't be, how could it go wrong, emmmm, it still feels wrong, so Google clicked:

1. Generally, decompress the zip file under linux, directly use the system default extract here to decompress (unzip is used by default)
2. If the compressed file .zip is larger than 2G, then unzip cannot be used, this is due to the C library The file offset that can be represented by the long type data can only be 2G on a 32-bit machine.
3. So if you want to decompress a large file, you can use 7zip to decompress


Install 7zip

Official website address: http://www.7-zip.org/download.html
Software download address: https://sourceforge.net/projects/p7zip/files/p7zip/

Installed here using version 16.02, linux environment

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


If you are prompted to install g++ when executing the make command, please execute:

yum install gcc-c++

When tar (child): bzip2: Cannot exec: No such file or directory appears , please install:

yum install bzip2 -y

When the following message appears, the installation is complete

./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


Use of 7z command

Unzip the 7z file:

7za x test.zip -r -o./


Parameter meaning:

  • x stands for unzipped files, and they are unzipped according to the original directory tree (there is also a parameter e which is also unzipped files, but it will unzip all files to the root, instead of its original folder)
  • test.zip is a compressed file in the current directory, used here as a test file
  • -r means recursively decompress all subfolders
  • -o specifies the directory to decompress to, there is no space after -o, directly connect to the directory (-o./ is the current directory)


Compressed files/folders

7za a -t7z -r test.7z /opt/test/*


Parameter meaning:

  • a stands for adding files/folders to the compressed package
  • -t is the specified compression type, here is set to 7z, but not specified, because 7za default compression type is 7z
  • -r means recursively all subfolders
  • test.7z is the name of the compressed package
  • /opt/test/* is the compressed directory


Note: 7za not only supports the .7z compression format, but also supports compression types such as .zip., tar, .bz2, etc.
 

Guess you like

Origin blog.csdn.net/I_lost/article/details/91438347