Unzip a ZIP file larger than 4GB on Linux.

Conclusion

--Do not create or receive ZIP files larger than 4GB. --Get it with tar or 7z. --If you get it, check the OS of the other party. --If you are using Linux or mac, you can decompress it with 7z. --Unar is used because encoding problems occur on Windows. (All may be unar)

What happened to the background?

I received a large amount of locally stored files from a customer. Since the original capacity is several hundred GB and it is physically difficult for me due to the influence of corona, I asked the customer to divide it at a good place and upload it to the file server, but those files It was the first time that was a ZIP of 2 to 10GB per file. I couldn't handle hundreds of GB on my local PC, so I tried to unzip it on ubuntu server, but I got into various problems.

1. ZIP files larger than 4GB cannot be UNZIPed.

Due to the influence of the library on the back of unzip, if it exceeds 4GB, the following error will occur and it cannot be decompressed. I'm surprised.

Archive: xyz.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.

If this is the only problem, you can fix it by installing 7z.

sudo apt install p7zip-full

In 7z, you can decompress with either e or x, but e ignores the folder structure and decompresses, so normally decompress with x.

7z x -o destdir xyz.zip

2. SHIFT-JIS is garbled

Most Japanese users of Windows use SHIFT-JIS standard. Since ZIP does not convert the character code, the SJIS file name is saved as SJIS as it is. Recent Linux and Mac are UTF8, so the characters will be garbled when decompressing. When I googled, various solutions (such as changing the LANG setting or using convnv) came out, but none of them worked.

As a result of various googles, it was solved in one shot by decompressing with unar. Installation is possible below

sudo apt install unar

Decompression is simple

unar xyz.zip

You can do it with. If the folder exists, you will be asked if you want to overwrite it, so if it is troublesome, use -f.

Finally

I think there are various things, but it seems that you will be happier if you do not use ZIP.

Recommended Posts

Unzip a ZIP file larger than 4GB on Linux.
Open a ZIP created on Windows in Linux
Unzip the internet zip file
On Linux, the time stamp of a file is a little past.
Install Arch Linux on DeskMini A300
Run a Linux server on GCP
Create a Linux environment on Windows 10
Build a simple WebDAV server on Linux
Make Unity Accelerator a service on Linux
Rename based on file modification time (Linux)
Create a Linux virtual machine on Windows
[Linux] Zip file compression and decompression commands [Vim]
How to disguise a ZIP file as a PNG file
Start a process with a scheduling policy on Linux
I want to log file I / O on Linux