解压缩 (Info-ZIP) 权限

SAr*_*her 5 linux permissions zip

有没有办法在 Linux 系统上调用 unzip(从 Info-ZIP),而无需恢复存储在 zip 文件中的权限?我正在恢复的 zip 文件很大,因此使用“chmod -R”之类的内容返回内容需要一段时间。我不控制档案的来源,所以我唯一的选择是处理提取权限。

Ant*_*hon 5

恢复权限是unzip(来自man页面,版本 6.00)的一个功能:

Dates,  times  and  permissions of stored directories are not restored
except under Unix. (On Windows NT and successors, timestamps  are  now
restored.)
Run Code Online (Sandbox Code Playgroud)

如果关闭,则没有选项可以关闭。

可能是旧版本的unzip不支持恢复权限,但调查该路线可能比尝试更改最新unzip源以执行您想要的操作更麻烦。

如果运行chmod -R是不可接受的,您可以查看使用 Python 的zipfile 库,它易于使用,并且可以让您完全控制编写从 zip 文件中提取的文件的方式。