当前,onedrive生成可被大多数软件破坏的zip文件。
正如我们在这里看到的,解决方案是使用十六进制编辑器。由于我有很多大文件,因此我需要bash脚本解决方案...可能吗?
这是一个免费提供的测试文件:
问题“ Microsoft OneDrive是否导出损坏的大型ZIP文件”中的链接中提到的问题?,是指一个问题,其中由OneDrive创建的大于4Gig的文件在ZIP64中具有无效Total Number of Disks
字段End Central Directory Locator
。该字段中的值应为1,但是OneDrive(似乎Windows send-to-zip)将其设置为0。这使得使用标准解压缩实用程序很难/不可能使用这些文件。
unzip
针对这些文件之一运行会产生如下输出
$ unzip -l onedrive-zip-test-zeros.zip
Archive: onedrive-zip-test-zeros.zip
warning [onedrive-zip-test-zeros.zip]: 1073742329 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [onedrive-zip-test-zeros.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)
原始问题中的链接显示了如何使用十六进制文件编辑器手动解决此问题。或者,请参阅Fix-OneDrive-Zip,获取将修复这些OneDrive zip文件的脚本。它所做的就是将值错误地设置为0,然后将其设置为1。
用法是
fix-onedrive-zip file1.zip
在这种情况下
$./fix-onedrive-zip onedrive-zip-test-zeros.zip
Checking 'onedrive-zip-test-zeros.zip'
Updated 'onedrive-zip-test-zeros.zip'
并检查zip文件是否可以读取
$ unzip -l onedrive-zip-test-zeros.zip
Archive: onedrive-zip-test-zeros.zip
Length Date Time Name
--------- ---------- ----- ----
1073741824 2020-03-18 14:48 onedrive-zip-test-zeros/file01.dat
1073741824 2020-03-18 14:51 onedrive-zip-test-zeros/file02.dat
1073741824 2020-03-18 14:54 onedrive-zip-test-zeros/file03.dat
1073741824 2020-03-18 14:57 onedrive-zip-test-zeros/file04.dat
1073741824 2020-03-18 15:01 onedrive-zip-test-zeros/file05.dat
--------- -------
5368709120 5 files
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句