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

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

问题描述

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

  7za a myzip.zip * -tzip -r 

我发现可以精确地运行 相同的命令行两次将产生两个不同的ZIP文件-它们具有相同的大小,但是如果您运行二进制比较(即fc / b file1.zip file2.zip),它们将不同。使事情变得复杂的是,如果您快速连续制作两个拉链,则它们 是相同的。但是,如果您在不同的日期进行操作或间隔几个小时,则不会。



我认为ZIP文件中某处有日期/时间戳,但我可以



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

解决方案

7-zip具有开关 -m 参数为 tc 的值,如果未在命令行上指定,则默认值为。 / p>

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




  • 上次修改时间,

  • 创建时间,以及

  • 最后访问时间。



请参见7-zip标题为 -m(设置压缩方法)开关



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



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


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

7za a myzip.zip * -tzip -r

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.

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 has the switch -m with parameter tc which has value on by default if not specified on command line.

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

  • the last modification time,
  • the creation time, and also
  • the last access time.

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.

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

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

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