[
  {
    "Id": "256488",
    "ThreadId": "74947",
    "Html": "<p>Hello,</p>\r\n<p>I am just wondering why when I create a zip file with the same set of source files and the checksum for the result zip file change each time. Nothing has changed inside the set of source.</p>\r\n<p>Here are the step I use to create the zip in VB.nET</p>\r\n<p>&nbsp;</p>\r\n<p>Dim pzip as ZipFile</p>\r\n<p>pzip.AddDirectory(sourcefolder, zipdirectory)</p>\r\n<p>pzip.save(targetfile)</p>\r\n<p>&nbsp;</p>\r\n<p>Once the process completed, I ran the MD5 checksum or even CRC32 process and both of these checksum generator generate different checksum each time new zip file create. I tried version 1.8 and beta 1.9 and still get the same result.</p>\r\n<p>&nbsp;</p>\r\n<p>Thank you.</p>\r\n<p>&nbsp;</p>\r\n<p>Hugh</p>",
    "PostedDate": "2009-11-12T13:56:32.42-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256548",
    "ThreadId": "74947",
    "Html": "<p>Hi hugh,</p>\r\n<p>I agree - the checksum should be the same.&nbsp;&nbsp; I just tried it here, and i get the same hash for the generated zip.</p>\r\n<p>That code doesn't run.&nbsp; What's the real code?&nbsp;</p>\r\n<p>If a timestamp changes on the file, the hash inside the zip will change.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-12T19:32:28.75-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256744",
    "ThreadId": "74947",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>Thank you for taking a look at it. Below are the code that I used to zip, generate the checksum. Also included is the CRC32 and Checksum function. I normally use MD5 checksum.</p>\r\n<pre>    Public Function GetFileChecksum(ByVal tfile As String, Optional ByVal tmode As String = &quot;MD5&quot;) As String\r\n        Try\r\n            If File.Exists(tfile) Then\r\n                Dim fStream As Stream = File.OpenRead(tfile)\r\n                Dim checksum() As Byte = {0}\r\n\r\n                Select Case tmode.ToLower\r\n                    Case &quot;sha1&quot;\r\n                        Dim mysha1 As SHA1 = New SHA1Managed()\r\n                        checksum = mysha1.ComputeHash(fStream)\r\n                    Case &quot;sha256&quot;\r\n                        Dim mysha256 As SHA256 = New SHA256Managed()\r\n                        checksum = mysha256.ComputeHash(fStream)\r\n                    Case &quot;sha384&quot;\r\n                        Dim mysha384 As SHA384 = New SHA384Managed()\r\n                        checksum = mysha384.ComputeHash(fStream)\r\n                    Case &quot;sha512&quot;\r\n                        Dim mysha512 As SHA512 = New SHA512Managed()\r\n                        checksum = mysha512.ComputeHash(fStream)\r\n                    Case Else\r\n                        Dim mymd5 As MD5 = MD5.Create()\r\n                        checksum = mymd5.ComputeHash(fStream)\r\n                End Select\r\n\r\n                fStream.Close()\r\n\r\n                Dim buff As StringBuilder = New StringBuilder\r\n                Dim hashByte As Byte\r\n                For Each hashByte In checksum\r\n                    buff.Append(String.Format(&quot;{0:X2}&quot;, hashByte))\r\n                Next\r\n\r\n                'Return Replace(BitConverter.ToString(checksum), &quot;-&quot;, &quot;&quot;)\r\n                Return buff.ToString\r\n            End If\r\n\r\n        Catch ex As Exception\r\n\r\n        End Try\r\n        Return 0\r\n    End Function\r\n\r\n    Public Function GetCRC32(ByVal sFileName As String) As String\r\n        Try\r\n            Dim FS As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)\r\n            Dim CRC32Result As Integer = &amp;HFFFFFFFF\r\n            Dim Buffer(4096) As Byte\r\n            Dim ReadSize As Integer = 4096\r\n            Dim Count As Integer = FS.Read(Buffer, 0, ReadSize)\r\n            Dim CRC32Table(256) As Integer\r\n            Dim DWPolynomial As Integer = &amp;HEDB88320\r\n            Dim DWCRC As Integer\r\n            Dim i As Integer, j As Integer, n As Integer\r\n\r\n            'Create CRC32 Table\r\n            For i = 0 To 255\r\n                DWCRC = i\r\n                For j = 8 To 1 Step -1\r\n                    If (DWCRC And 1) Then\r\n                        DWCRC = ((DWCRC And &amp;HFFFFFFFE) \\ 2&amp;) And &amp;H7FFFFFFF\r\n                        DWCRC = DWCRC Xor DWPolynomial\r\n                    Else\r\n                        DWCRC = ((DWCRC And &amp;HFFFFFFFE) \\ 2&amp;) And &amp;H7FFFFFFF\r\n                    End If\r\n                Next j\r\n                CRC32Table(i) = DWCRC\r\n            Next i\r\n\r\n            'Calcualting CRC32 Hash\r\n            Do While (Count &gt; 0)\r\n                For i = 0 To Count - 1\r\n                    n = (CRC32Result And &amp;HFF) Xor Buffer(i)\r\n                    CRC32Result = ((CRC32Result And &amp;HFFFFFF00) \\ &amp;H100) And &amp;HFFFFFF\r\n                    CRC32Result = CRC32Result Xor CRC32Table(n)\r\n                Next i\r\n                Count = FS.Read(Buffer, 0, ReadSize)\r\n            Loop\r\n\r\n            FS.Close()\r\n            Return Hex(Not (CRC32Result))\r\n        Catch ex As Exception\r\n            MsgBox(&quot;CRC32 calculate error: &quot; &amp; ex.StackTrace)\r\n        End Try\r\n        Return &quot;&quot;\r\n    End Function\r\n\r\n    Public Function getDirectoryName(ByVal tpath As String) As String\r\n        Dim tdir As String = &quot;&quot;\r\n        Try\r\n            Dim tinfo As New DirectoryInfo(tpath)\r\n            tdir = tinfo.Name\r\n        Catch ex As Exception\r\n\r\n        End Try\r\n\r\n        Return tdir\r\n    End Function\r\n\r\n    Public Function ZipFolder(ByRef pzip As ZipFile, ByVal targetzip As String, ByVal sourcefolder As String _\r\n                          , Optional ByVal trecursive As Boolean = True _\r\n                          , Optional ByVal tfilter As String = &quot;&quot;, Optional ByRef tbar As ToolStripProgressBar = Nothing) As Boolean\r\n        Try\r\n            ' Delete existing zip file\r\n            If File.Exists(targetzip) Then\r\n                File.Delete(targetzip)\r\n            End If\r\n\r\n            'pzip = New ZipFile(targetzip)\r\n            'Dim zipentry As ZipEntry\r\n\r\n\r\n            'zipentry = pzip.AddDirectory(sourcefolder, getDirectoryName(sourcefolder))\r\n            'pzip.AddSelectedFiles(&quot;name != *~* And name != *$* And name != *.bak And name != *.BAK&quot;, sourcefolder, getDirectoryName(sourcefolder), True)\r\n            pzip.AddSelectedFiles(tfilter, sourcefolder, getDirectoryName(sourcefolder), True)\r\n\r\n            If Not tbar Is Nothing Then\r\n                tbar.Minimum = 0\r\n                tbar.Value = 0\r\n            End If\r\n\r\n            'pzip.Save()\r\n\r\n            pzip.Save(targetzip)\r\n\r\n            If File.Exists(targetzip) Then\r\n                Return True\r\n            Else\r\n                Return False\r\n            End If\r\n        Catch ex As Exception\r\n            MsgBox(&quot;Message&quot; &amp; ex.Message &amp; vbCr &amp; &quot;Stack Trace:&quot; &amp; vbCr &amp; ex.StackTrace, MsgBoxStyle.Critical, &quot;Zip Process Error&quot;)\r\n        End Try\r\n\r\n        Return False\r\n    End Function\r\n\r\n</pre>",
    "PostedDate": "2009-11-13T06:22:32.31-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256783",
    "ThreadId": "74947",
    "Html": "<p>Hello Hugh,</p>\r\n<p>Thanks for the code - Just ran it, totally unchanged, and got the same results I saw earlier:&nbsp; the Md5 checksum for the generated zip file is always the same, for a set of files that has not changed.</p>\r\n<p>If I &quot;touch&quot; a file in the folder (update its timestamp), then the checksum of the resulting zip file is different, as expected.&nbsp;</p>\r\n<p>Here's my code, in its entirety:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Green\">' HughChksum.vb</span>\r\n<span style=\"color:Green\">'</span>\r\n<span style=\"color:Green\">' Fri, 13 Nov 2009  10:26</span>\r\n<span style=\"color:Green\">'</span>\r\n<span style=\"color:Green\">' compile with</span>\r\n<span style=\"color:Green\">'</span>\r\n<span style=\"color:Green\">'       c:\\.net3.5\\vbc.exe /t:exe /debug:full /R:Ionic.Zip.dll /out:HughChksum.exe HughChksum.vb</span>\r\n<span style=\"color:Green\">'</span>\r\n<span style=\"color:Green\">' ------------------------------------------------------------------</span>\r\n\r\n\r\n\r\n<span style=\"color:Blue\">Imports</span> System\r\n<span style=\"color:Blue\">Imports</span> System.IO\r\n<span style=\"color:Blue\">Imports</span> System.Text\r\n<span style=\"color:Blue\">Imports</span> System.Windows.Forms\r\n<span style=\"color:Blue\">Imports</span> System.Security.Cryptography\r\n<span style=\"color:Blue\">Imports</span> Ionic.Zip\r\n\r\n<span style=\"color:Blue\">Namespace</span> Ionic.Tests.Zip\r\n\r\n<span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Class</span> HughChksum\r\n\r\n    <span style=\"color:Green\">' Methods</span>\r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Function</span> GetFileChecksum(<span style=\"color:Blue\">ByVal</span> tfile <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>, <span style=\"color:Blue\">Optional</span> <span style=\"color:Blue\">ByVal</span> tmode <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;MD5&quot;</span>) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>\r\n        <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Blue\">If</span> File.Exists(tfile) <span style=\"color:Blue\">Then</span>\r\n                <span style=\"color:Blue\">Dim</span> fStream <span style=\"color:Blue\">As</span> Stream = File.OpenRead(tfile)\r\n                <span style=\"color:Blue\">Dim</span> checksum() <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Byte</span> = {0}\r\n\r\n                <span style=\"color:Blue\">Select</span> <span style=\"color:Blue\">Case</span> tmode.ToLower\r\n                    <span style=\"color:Blue\">Case</span> <span style=\"color:#A31515\">&quot;sha1&quot;</span>\r\n                        <span style=\"color:Blue\">Dim</span> mysha1 <span style=\"color:Blue\">As</span> SHA1 = <span style=\"color:Blue\">New</span> SHA1Managed()\r\n                        checksum = mysha1.ComputeHash(fStream)\r\n                    <span style=\"color:Blue\">Case</span> <span style=\"color:#A31515\">&quot;sha256&quot;</span>\r\n                        <span style=\"color:Blue\">Dim</span> mysha256 <span style=\"color:Blue\">As</span> SHA256 = <span style=\"color:Blue\">New</span> SHA256Managed()\r\n                        checksum = mysha256.ComputeHash(fStream)\r\n                    <span style=\"color:Blue\">Case</span> <span style=\"color:#A31515\">&quot;sha384&quot;</span>\r\n                        <span style=\"color:Blue\">Dim</span> mysha384 <span style=\"color:Blue\">As</span> SHA384 = <span style=\"color:Blue\">New</span> SHA384Managed()\r\n                        checksum = mysha384.ComputeHash(fStream)\r\n                    <span style=\"color:Blue\">Case</span> <span style=\"color:#A31515\">&quot;sha512&quot;</span>\r\n                        <span style=\"color:Blue\">Dim</span> mysha512 <span style=\"color:Blue\">As</span> SHA512 = <span style=\"color:Blue\">New</span> SHA512Managed()\r\n                        checksum = mysha512.ComputeHash(fStream)\r\n                    <span style=\"color:Blue\">Case</span> <span style=\"color:Blue\">Else</span>\r\n                        <span style=\"color:Blue\">Dim</span> mymd5 <span style=\"color:Blue\">As</span> MD5 = MD5.Create()\r\n                        checksum = mymd5.ComputeHash(fStream)\r\n                <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Select</span>\r\n\r\n                fStream.Close()\r\n\r\n                <span style=\"color:Blue\">Dim</span> buff <span style=\"color:Blue\">As</span> StringBuilder = <span style=\"color:Blue\">New</span> StringBuilder\r\n                <span style=\"color:Blue\">Dim</span> hashByte <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Byte</span>\r\n                <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> hashByte <span style=\"color:Blue\">In</span> checksum\r\n                    buff.Append(<span style=\"color:Blue\">String</span>.Format(<span style=\"color:#A31515\">&quot;{0:X2}&quot;</span>, hashByte))\r\n                <span style=\"color:Blue\">Next</span>\r\n\r\n                <span style=\"color:Green\">'Return Replace(BitConverter.ToString(checksum), &quot;-&quot;, &quot;&quot;)</span>\r\n                <span style=\"color:Blue\">Return</span> buff.ToString\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n\r\n        <span style=\"color:Blue\">Catch</span> ex <span style=\"color:Blue\">As</span> Exception\r\n\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n        <span style=\"color:Blue\">Return</span> 0\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Function</span> GetCRC32(<span style=\"color:Blue\">ByVal</span> sFileName <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>\r\n        <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Blue\">Dim</span> FS <span style=\"color:Blue\">As</span> FileStream = <span style=\"color:Blue\">New</span> FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)\r\n            <span style=\"color:Blue\">Dim</span> CRC32Result <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span> = &amp;HFFFFFFFF\r\n            <span style=\"color:Blue\">Dim</span> Buffer(4096) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Byte</span>\r\n            <span style=\"color:Blue\">Dim</span> ReadSize <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span> = 4096\r\n            <span style=\"color:Blue\">Dim</span> <span style=\"color:Blue\">Count</span> <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span> = FS.Read(Buffer, 0, ReadSize)\r\n            <span style=\"color:Blue\">Dim</span> CRC32Table(256) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>\r\n            <span style=\"color:Blue\">Dim</span> DWPolynomial <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span> = &amp;HEDB88320\r\n            <span style=\"color:Blue\">Dim</span> DWCRC <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>\r\n            <span style=\"color:Blue\">Dim</span> i <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>, j <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>, n <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>\r\n\r\n            <span style=\"color:Green\">'Create CRC32 Table</span>\r\n            <span style=\"color:Blue\">For</span> i = 0 <span style=\"color:Blue\">To</span> 255\r\n                DWCRC = i\r\n                <span style=\"color:Blue\">For</span> j = 8 <span style=\"color:Blue\">To</span> 1 <span style=\"color:Blue\">Step</span> -1\r\n                    <span style=\"color:Blue\">If</span> (DWCRC <span style=\"color:Blue\">And</span> 1) <span style=\"color:Blue\">Then</span>\r\n                        DWCRC = ((DWCRC <span style=\"color:Blue\">And</span> &amp;HFFFFFFFE) \\ 2&amp;) <span style=\"color:Blue\">And</span> &amp;H7FFFFFFF\r\n                        DWCRC = DWCRC <span style=\"color:Blue\">Xor</span> DWPolynomial\r\n                    <span style=\"color:Blue\">Else</span>\r\n                        DWCRC = ((DWCRC <span style=\"color:Blue\">And</span> &amp;HFFFFFFFE) \\ 2&amp;) <span style=\"color:Blue\">And</span> &amp;H7FFFFFFF\r\n                    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n                <span style=\"color:Blue\">Next</span> j\r\n                CRC32Table(i) = DWCRC\r\n            <span style=\"color:Blue\">Next</span> i\r\n\r\n            <span style=\"color:Green\">'Calcualting CRC32 Hash</span>\r\n            <span style=\"color:Blue\">Do</span> <span style=\"color:Blue\">While</span> (<span style=\"color:Blue\">Count</span> &gt; 0)\r\n                <span style=\"color:Blue\">For</span> i = 0 <span style=\"color:Blue\">To</span> <span style=\"color:Blue\">Count</span> - 1\r\n                    n = (CRC32Result <span style=\"color:Blue\">And</span> &amp;HFF) <span style=\"color:Blue\">Xor</span> Buffer(i)\r\n                    CRC32Result = ((CRC32Result <span style=\"color:Blue\">And</span> &amp;HFFFFFF00) \\ &amp;H100) <span style=\"color:Blue\">And</span> &amp;HFFFFFF\r\n                    CRC32Result = CRC32Result <span style=\"color:Blue\">Xor</span> CRC32Table(n)\r\n                <span style=\"color:Blue\">Next</span> i\r\n                <span style=\"color:Blue\">Count</span> = FS.Read(Buffer, 0, ReadSize)\r\n            <span style=\"color:Blue\">Loop</span>\r\n\r\n            FS.Close()\r\n            <span style=\"color:Blue\">Return</span> Hex(<span style=\"color:Blue\">Not</span> (CRC32Result))\r\n        <span style=\"color:Blue\">Catch</span> ex <span style=\"color:Blue\">As</span> Exception\r\n            MsgBox(<span style=\"color:#A31515\">&quot;CRC32 calculate error: &quot;</span> &amp; ex.StackTrace)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n        <span style=\"color:Blue\">Return</span> <span style=\"color:#A31515\">&quot;&quot;</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n\r\n    \r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Function</span> getDirectoryName(<span style=\"color:Blue\">ByVal</span> tpath <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>\r\n        <span style=\"color:Blue\">Dim</span> tdir <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;&quot;</span>\r\n        <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Blue\">Dim</span> tinfo <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">New</span> DirectoryInfo(tpath)\r\n            tdir = tinfo.Name\r\n        <span style=\"color:Blue\">Catch</span> ex <span style=\"color:Blue\">As</span> Exception\r\n\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n\r\n        <span style=\"color:Blue\">Return</span> tdir\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n\r\n    \r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Function</span> ZipFolder(<span style=\"color:Blue\">ByRef</span> pzip <span style=\"color:Blue\">As</span> ZipFile, <span style=\"color:Blue\">ByVal</span> targetzip <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>, <span style=\"color:Blue\">ByVal</span> sourcefolder <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> _\r\n                              , <span style=\"color:Blue\">Optional</span> <span style=\"color:Blue\">ByVal</span> trecursive <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span> = <span style=\"color:Blue\">True</span> _\r\n                              , <span style=\"color:Blue\">Optional</span> <span style=\"color:Blue\">ByVal</span> tfilter <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;*.*&quot;</span>, <span style=\"color:Blue\">Optional</span> <span style=\"color:Blue\">ByRef</span> tbar <span style=\"color:Blue\">As</span> ToolStripProgressBar = <span style=\"color:Blue\">Nothing</span>) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span>\r\n        <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Green\">' Delete existing zip file</span>\r\n            <span style=\"color:Blue\">If</span> File.Exists(targetzip) <span style=\"color:Blue\">Then</span>\r\n                File.Delete(targetzip)\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n\r\n            <span style=\"color:Green\">'pzip = New ZipFile(targetzip)</span>\r\n            <span style=\"color:Green\">'Dim zipentry As ZipEntry</span>\r\n\r\n            <span style=\"color:Green\">'zipentry = pzip.AddDirectory(sourcefolder, getDirectoryName(sourcefolder))</span>\r\n            <span style=\"color:Green\">'pzip.AddSelectedFiles(&quot;name != *~* And name != *$* And name != *.bak And name != *.BAK&quot;, sourcefolder, getDirectoryName(sourcefolder), True)</span>\r\n            pzip.AddSelectedFiles(tfilter, sourcefolder, getDirectoryName(sourcefolder), <span style=\"color:Blue\">True</span>)\r\n\r\n            <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Not</span> tbar <span style=\"color:Blue\">Is</span> <span style=\"color:Blue\">Nothing</span> <span style=\"color:Blue\">Then</span>\r\n                tbar.Minimum = 0\r\n                tbar.Value = 0\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n\r\n            <span style=\"color:Green\">'pzip.Save()</span>\r\n\r\n            pzip.Save(targetzip)\r\n\r\n            <span style=\"color:Blue\">If</span> File.Exists(targetzip) <span style=\"color:Blue\">Then</span>\r\n                <span style=\"color:Blue\">Return</span> <span style=\"color:Blue\">True</span>\r\n            <span style=\"color:Blue\">Else</span>\r\n                <span style=\"color:Blue\">Return</span> <span style=\"color:Blue\">False</span>\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n        <span style=\"color:Blue\">Catch</span> ex <span style=\"color:Blue\">As</span> Exception\r\n            MsgBox(<span style=\"color:#A31515\">&quot;Message&quot;</span> &amp; ex.Message &amp; vbCr &amp; <span style=\"color:#A31515\">&quot;Stack Trace:&quot;</span> &amp; vbCr &amp; ex.StackTrace, MsgBoxStyle.Critical, <span style=\"color:#A31515\">&quot;Zip Process Error&quot;</span>)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n\r\n        <span style=\"color:Blue\">Return</span> <span style=\"color:Blue\">False</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n\r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> Run()\r\n        <span style=\"color:Blue\">Dim</span> name <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;HughChksum.zip&quot;</span>\r\n        \r\n        <span style=\"color:Blue\">Using</span> zip <span style=\"color:Blue\">As</span> ZipFile  = <span style=\"color:Blue\">New</span> ZipFile\r\n            zip.StatusMessageTextWriter = System.Console.Out\r\n            ZipFolder(zip, name, folderToZip)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span> \r\n\r\n        System.Console.WriteLine(<span style=\"color:#A31515\">&quot;{0}&quot;</span>, GetFileChecksum(Name))\r\n        \r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    \r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Sub</span> Main(<span style=\"color:Blue\">ByVal</span> args <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>())\r\n    <span style=\"color:Blue\">Try</span> \r\n        <span style=\"color:Blue\">Dim</span> X <span style=\"color:Blue\">as</span> <span style=\"color:Blue\">New</span> HughChksum(args)\r\n        X.Run\r\n    <span style=\"color:Blue\">Catch</span> exc1 <span style=\"color:Blue\">As</span> Exception\r\n        Console.WriteLine(<span style=\"color:#A31515\">&quot;Exception: {0}&quot;</span>, exc1.ToString)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n\r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> <span style=\"color:Blue\">New</span>(<span style=\"color:Blue\">ByVal</span> args <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>())\r\n        <span style=\"color:Blue\">If</span> args.Length &lt;&gt; 1 <span style=\"color:Blue\">Then</span>\r\n            Usage\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n        \r\n        <span style=\"color:Blue\">If</span> args(0)=<span style=\"color:#A31515\">&quot;-?&quot;</span> <span style=\"color:Blue\">Then</span>\r\n            Usage\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n\r\n        folderToZip = args(0)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> folderToZip <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Sub</span> Usage()\r\n        Console.WriteLine( _\r\n        <span style=\"color:#A31515\">&quot;HughChksum: zips a folder and computes an MD5 checksum on the resulting zip. &quot;</span> &amp; vbcrlf &amp; _\r\n        <span style=\"color:#A31515\">&quot;usage:&quot;</span> &amp; ChrW(10) &amp; <span style=\"color:#A31515\">&quot;  HughChksum &lt;folderToZip&gt;&quot;</span> &amp; vbcrlf _\r\n              )\r\n        Environment.<span style=\"color:Blue\">Exit</span>(1)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Class</span>\r\n\r\n\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Namespace</span>\r\n\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-13T07:34:45.073-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256850",
    "ThreadId": "74947",
    "Html": "<p>Thank you very much for your help. This is just weird, I ran your test case on my set and the checksum are different each time. I don't see anything I can attach the file of my zip source but basically, I have 10 identical files 5 in the root folder and the other in the &nbsp;sub folder as shown.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">Ziptest</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">found 10 files...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">saving....</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">1FAA0D1B7B83A3D77EA0A75ECD1EC137</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">Ziptest</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">found 10 files...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">saving....</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">8002C651428848F629D5C4CA491A5EA8</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">Ziptest</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">found 10 files...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">saving....</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">DB2939073424B932AB2AF6B57B180304</div>\r\n<p>\r\n<p>C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</p>\r\n<p>Ziptest</p>\r\n<p>adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</p>\r\n<p>found 10 files...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</p>\r\n<p>saving....</p>\r\n<p>1FAA0D1B7B83A3D77EA0A75ECD1EC137</p>\r\n<p>&nbsp;</p>\r\n<p>C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</p>\r\n<p>Ziptest</p>\r\n<p>adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</p>\r\n<p>found 10 files...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</p>\r\n<p>saving....</p>\r\n<p>8002C651428848F629D5C4CA491A5EA8</p>\r\n<p>&nbsp;</p>\r\n<p>C:\\DOTNET\\ZipConsole\\ZipConsole\\bin\\Release&gt;ConsoleApplication1 C:\\ICT\\Programs\\</p>\r\n<p>Ziptest</p>\r\n<p>adding selection '*.*' from dir 'C:\\ICT\\Programs\\Ziptest'...</p>\r\n<p>found 10 files...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8001.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8002.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8003.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</p>\r\n<p>adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</p>\r\n<p>saving....</p>\r\n<p>DB2939073424B932AB2AF6B57B180304</p>\r\n</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-13T10:02:01.767-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256880",
    "ThreadId": "74947",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>very weird. But I have an idea.</p>\r\n<p>ok try this:</p>\r\n<p>modify the code so the Run sub looks like this:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> Run()\r\n        <span style=\"color:Blue\">Dim</span> name <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;HughChksum.zip&quot;</span>\r\n        \r\n        <span style=\"color:Blue\">Using</span> zip <span style=\"color:Blue\">As</span> ZipFile  = <span style=\"color:Blue\">New</span> ZipFile\r\n            zip.EmitTimesInWindowsFormatWhenSaving = <span style=\"color:Blue\">False</span>  <span style=\"color:Green\">'' &lt;-- insert this</span>\r\n            zip.StatusMessageTextWriter = System.Console.Out\r\n            ZipFolder(zip, name, folderToZip)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span> \r\n\r\n        System.Console.WriteLine(<span style=\"color:#A31515\">&quot;{0}&quot;</span>, GetFileChecksum(Name))\r\n        \r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n</pre>\r\n</div>\r\n<p>By default,&nbsp;the library stores 3 timestamps for each file into the zip: the created, modified, and &quot;last accessed&quot; time.&nbsp; And yes,&nbsp;in NTFS, the &quot;last accessed&quot; time gets updated when you read the file.</p>\r\n<p>As I was trying to figure out what could be changing, it occurred to me - I think I may have disabled lastaccess&nbsp;tracking on my NTFS volume, as a performance optimization.&nbsp; Which means, the &quot;last accessed&quot; time is updated lazily, and in my case it might not be updated at all.&nbsp; In your case, &quot;last access&quot; tracking could still be enabled on your NTFS volume, which means it will be updated, every time you read each ini file.&nbsp;</p>\r\n<p>By inserting that extra line into the code, you're telling the library not to include any of the timestamps into the zip.&nbsp;&nbsp; If this produces zips with the same checksum, then you know it's the timestamp.</p>\r\n<p>We can talk about whether you want to use EmitTimesInWindowsFormatWhenSaving in your production, after you run the test.</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-11-13T11:05:32.28-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256887",
    "ThreadId": "74947",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>Upon further review, in Windows Vista, NTFS&nbsp;&quot;last access&quot; tracking is disabled by default.</p>\r\n<p><a href=\"http://blogs.technet.com/filecab/archive/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance.aspx\">http://blogs.technet.com/filecab/archive/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance.aspx</a>&nbsp;</p>\r\n<p>In Windows XP and other operating systems, I believe it is enabled by default.&nbsp; Regardless of the OS you're using, you may have it enabled, in which case the content of the zip would change.</p>\r\n<p>I have it disabled&nbsp;- I use Vista, so it's disabled by default - and as a result the timestamps don't change, and the checksums don't change.</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-11-13T11:12:55.74-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256893",
    "ThreadId": "74947",
    "Html": "<p>After inserted the line at the code the problem fixed. I get the same checksum for both run now.</p>\r\n<pre style=\"font-size:1em;font-family:Consolas, 'Courier New', Courier, monospace\"><div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8004.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\TR8005.INI..</div><div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800A.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800B.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800C.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800D.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">adding C:\\ICT\\Programs\\Ziptest\\Folder1\\TR800F.INI...</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">saving....</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">2C8F5ACBE62764EC8B50F8D2DF12409F</div></pre>",
    "PostedDate": "2009-11-13T11:20:23.537-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256903",
    "ThreadId": "74947",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>ok, so that clears up the mystery.&nbsp; Now, you have to decide whether you want the timestamps in there or not.</p>\r\n<p>Some people use a checksum on a zip to find out if it's been changed, before transmitting it for example.&nbsp; If that's your scenario they you're gonna want the zip to be the same, all the way down to the timestamp.&nbsp;</p>\r\n<p>On the other hand some people like the extended timestamps in the zip file.&nbsp; Without those, when you unzip, the unzipped files&nbsp;will not have the same time/date metadata.</p>\r\n<p>If you want both - you want the timestamps in there, but you also want the checksum to be consistent - then you can manually set the AccessedTime property on each Entry as it is added to the zip, prior to saving it. You can set it to a fixed time, or set it to the latest &quot;last modified&quot; time of any entry.&nbsp;&nbsp; Either way it will result in a zip file that has the same checksum, each time.</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-11-13T11:39:36.127-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256912",
    "ThreadId": "74947",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>The first scenario is what I want. I am using the checksum to compare with what I already had on the server to see if I need to make the upload or not. Since the directory that I want has a bunch of files and I don't want to index each one by itself. What I do is zipped the whole directory and compare the checksum of the server version with the current version. If they are not the same then I will transmit if they are the same then abort. So, I really do not want the last access time. I just want to get the Create/Modified time.</p>\r\n<p>So after reading the documentation on the zip doc, I think I will set this flag to false. I really do not care about the time on the zip file itself, just the content of the zip only.</p>\r\n<p>&nbsp;</p>\r\n<p>Thank you very very much for all of your help. This is such a great work. Keep up the great job you are doing.</p>",
    "PostedDate": "2009-11-13T12:01:55.69-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "256917",
    "ThreadId": "74947",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>Thanks for the compliments.</p>\r\n<p>&gt; I really do not want the last access time. I just want to get the Create/Modified time.</p>\r\n<p>&gt; I really do not care about the time on the zip file itself,...</p>\r\n<p>to clarify, the timestamps I mentioned previously are on the <em>entries within the zip</em>, not on the zip file itself.&nbsp;&nbsp;</p>\r\n<p>AND, If you want the create+modified times&nbsp; - those are 2 different timestamps -&nbsp; then you need the extended tiemstamp.&nbsp; To do this you must set EmitTimesInWindowsFormatWhenSaving = True, or don't set it at all (True is the default).&nbsp; In this case, you will need to set the AccessedTime on each entry in order to keep the checksum of the generated zip file, constant across multiple runs.</p>\r\n<p>If you are happy with only the modified time on each entry inside the zip, then you can set EmitTimesInWindowsFormatWhenSaving to False.&nbsp;&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-11-13T12:22:52.593-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]