7zip 从相同的输入产生不同的输出 [英] 7zip produces different output from identical input

查看:40
本文介绍了7zip 从相同的输入产生不同的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用命令行 7zip 来压缩文件夹的内容(在 Windows 中),因此:

I'm using command line 7zip to zip up the contents of a folder (in Windows) thus:

7za a myzip.zip * -tzip -r

我发现完全运行相同的命令行两次会产生两个不同的 ZIP 文件 - 它们的大小相同,但如果您运行二进制比较(即 fc/b file1.zip 文件).zip file2.zip) 它们是不同的.更复杂的是,如果您快速连续制作两个拉链,那么它们 是相同的.但是,如果您在不同的日子或相隔几个小时进行这些操作,则不会.

I've discovered that running exactly the same command line twice will produce two different ZIP files - they've got the same size but if you run a binary compare (ie fc /b file1.zip file2.zip) they are different. To complicate matters it seems that if you make the two zips in rapid succession then they are the same. But if you do them on different days or separated by a few hours they are not.

我认为 ZIP 文件中某处有日期/时间戳,但我在 7zip 站点上找不到任何内容来确认这一点.

I presume that there's a date/time stamp in the ZIP file somewhere but I can't find anything on the 7zip site to confirm that.

假设我是对的,有人知道如何抑制日期/时间吗?还是其他原因导致二进制文件不同?

Assuming I'm right does anyone know how to suppress the date/time? Or is something else causing the binaries to be different?

推荐答案

7-zip 具有开关 -m 和参数 tc 其值为 on 默认情况下,如果未在命令行中指定.

7-zip has the switch -m with parameter tc which has value on by default if not specified on command line.

使用 -mtc=on 存储在 NTFS 分区上的文件的所有 3 个日期都存储在存档中:

With -mtc=on all 3 dates of a file stored on an NTFS partition are stored in the archive:

  • 最后修改时间,
  • 创建时间,还有
  • 上次访问时间.

在 7-zip 的帮助下看到标题为 -m(设置压缩方法)开关.

See in help of 7-zip the page with title -m (Set compression Method) switch.

文件的最后访问时间很可能是造成存档文件之间差异的原因.

The last access time of the files is most likely responsible for the differences between the archive files.

您必须附加 -mtc=off 以避免在存档文件中存储 NTFS 时间戳.

You have to append -mtc=off to avoid storage of the NTFS timestamps in archive file.

这篇关于7zip 从相同的输入产生不同的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆