在解压一个比较大的文件的时候(大于4GB的zip),使用unzip,结果显示
Archive: {my file} 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 zip file comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of {my file} or {my file}.zip, and cannot find {my_file}.ZIP, period.
一搜索得知,文件大于2G,或者也有的说是4G时,unzip因为无法读取到文件尾,而无法完成操作。
如果直接双击文件,使用Archive Utility解压文件,在你看到滚动条走到100时,它突然说
Unable to expand "{my file}" into "{my folder}". (Error 2 - No such file or directory.)
或者
Unable to expand "{my file}" into "{my folder}". (Error 1 - Operation not permitted.)
你会不会有点生气?
在你点击了OK之后,它会显示正在删除解压出来的临时文件,郁闷了吧。
这个时候你也许会转向使用windows vista或者使用7z工具吧。我就是这么做的。使用windows vista,剩余空间太少。使用7z,解压至500M的时候,报错。
自古华山一条路,只有试着把Archive Utility解压出来的临时文件抢出来了,也许它可能不完全,但至少你可以拿到大部分解压出来的数据吧。
首先要找到Archive Utility存放临时文件的位置,其次,在Archive Utility报错的时候,中止它,使用它无法删除临时文件。最后把文件转移到你需要的位置。
Archive Utility存放临时文件的位置
sudo find /var/folders -name 'Cleanup At Startup'
上面的命令的意思就是在/var/folders里及其子目录里查找名为’Cleanup At Startup’的目录。你可能会找到不止一个这样的目录。接下来的任务就是一个一个的去试,看看解压出来的临时文件放在什么位置了。
你可以使用
ls -lah
命令来帮助你查看’Cleanup At Startup’当中的临时文件,你也可以使用
find ./Cleanup\ At\ Startup -type f -exec du {} \; | sort -nr | head -10
来查看’Cleanup At Startup’当中最大的10个文件在什么位置。很快,你就会找到那个解压出来的临时文件的。
而后使用
ps ax | grep Archive
来查看Archive Utility app使用的PID,之后使用
kill -9 {pid}
的办法停止Archive Utility app.
当然最后一步也可以是在终止archive Utility app之前做,那就是使用mv使用将解压出来的临时文件放到你需要的位置去。