无法在 Linux 机器上解压 .zip 文件

问题描述 投票:0回答:5

我有一个约 10GB 的大 zip 文件,它是使用标准 Windows 方法创建的(右键单击,选择“发送到压缩(zipped)文件夹”)。我可以在我的 Macbook 上解压它。

我正在尝试在 EC2 机器上解压缩它。我知道该文件是一个 zip 文件,因为当我运行

file file.zip
时,它会显示:

file.zip: Zip archive data, at least v2.0 to extract

运行

unzip
返回以下错误:

Archive:  file.zip
warning [file.zip]:  3082769992 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [file.zip]:  start of central directory not found;
  zipfile corrupt.
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

运行

tar xvf file.zip
返回以下内容:

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains `<{\204\027\333"D\344\210\321o\331' where numeric         off_t value expected
tar: Archive contains `S\354\202},F\3546\276[\265\273' where numeric     time_t value expected
tar: Archive contains ``3c\254\372$:e' where numeric uid_t value expected
tar: Archive contains `\265\306\025+ܫL\352' where numeric gid_t value expected
...etc

有人知道可能出了什么问题吗?

amazon-web-services amazon-ec2 zip tar
5个回答
19
投票

实际上,7-zip 应该可以很好地完成此操作,您可以通过以下方式安装它:

sudo apt-get install p7zip-full

然后,您可以按如下方式解压 zip 文件:

7z e file.zip

3
投票

由于没有 sudo 访问权限,我无法在我的计算机上安装 7z,但我设法使用

修复了存档

zip -FF archive.zip --out archive_repaired.zip -fz

unzip
致力于修复档案。

我通过这个github问题找到了解决方案


0
投票

如果您的 zip 存档有 88,000 个文件,并且您正在处理 ~10Gig 的内容,则您将需要一个支持 zip64 扩展名的解压缩程序。

你可以这样检查你的解压程序是否支持zip64

$ unzip -v | grep -i zip64
        ZIP64_SUPPORT (archives using Zip64 for large files supported)

如果没有ZIP64_SUPPORT,那你就不走运了。我怀疑你的解压不支持zip64

替代方案是获取支持 zip64 的 unzip 版本或使用替代程序,例如 z-zip。


0
投票

您的整个文件很可能没有压缩,并且您过早地移动了它。至少这是我的问题。


0
投票

现在 Windows 拥有适用于 Linux 的 Windows 子系统 (WSL):

https://learn-microsoft-com.translate.goog/en-us/windows/wsl/about?_x_tr_sl=en&_x_tr_tl=tr&_x_tr_hl=tr&_x_tr_pto=sc

如果还没有安装,首先需要安装:

https://learn.microsoft.com/en-us/windows/wsl/install

默认发行版是 Ubuntu,但您可以更改它。

安装 WSL(当前为 WSL2)后,您只需键入“wsl”即可在 Windows PowerShell 终端中运行 linux 终端。

好吧,之后您就进入了 Linux 命令行,您可以按照此处所述为您的 Linux 服务器适当地压缩文件/文件夹:

https://logfetch.com/wsl2-zip-unzip-files/

我这样做是为了将我的 Web (laravel) 应用程序上传并部署到 AWS Elastic Beanstalk。

© www.soinside.com 2019 - 2024. All rights reserved.