如何向 zip 文件添加注释

How to add comments to a zip file

我研究了几天,发现我们可以将包含一些内容的文件添加到 zip 文件中,然后再次压缩它。然后评论将被添加到zip文件中,但我不知道那个文件到底是什么,所以任何人都知道在zip(压缩)文件中添加评论的原理

阅读您的 zip 版本的手册。在 Macintosh 上,-c 参数将允许您添加注释行。

-c 参数可让您以交互方式为 zip 中的每个文件添加一行注释。例如。 zip -c valid.zip somefile.txt

-z 参数可让您以交互方式为整个 zip 存档添加多行注释。例如。 zip -z valid.zip somefile.txt

对于命令行使用,将每个文件注释 (-c) and/or 每个 zip 注释 (-z) 提供给 stdin。当使用 both 时,首先输入每个文件的注释(每行一行),然后是每个 zip 注释行。示例:

$ touch one.txt two.txt

$ zip -c -z commented.zip one.txt two.txt <<END
> Comment for one
> Comment for two
> Remaining lines are zip-level comment
> lines. There can be more than one line here.
> End with a dot:
> .
> END
  adding: one.txt (stored 0%)
  adding: two.txt (stored 0%)
Enter comment for one.txt:
Enter comment for two.txt:
enter new zip file comment (end with .):

$ unzip -l commented.zip 
Archive:  commented.zip
Remaining lines are zip-level comment
lines. There can be more than one line here.
End with a dot:
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  11-13-2019 10:06   one.txt
Comment for one
        0  11-13-2019 10:06   two.txt
Comment for two
---------                     -------
        0                     2 files