[
  {
    "Id": "738475",
    "ThreadId": "291660",
    "Html": "\r\n<p>DNZ is great first of all!</p>\r\n<p>using v1.9 Ionic.Zip.Reduced.dll</p>\r\n<p>running on windows server 2003 R2 - SP2</p>\r\n<p>When trying to zip a directory consisting of 288,782 files, I get the error code below.&nbsp; The [old_files] variable is simply a generic List(of String) containing the file path(s) to all&nbsp;file(s) that are older than 6 months in the specified directory.&nbsp;I\r\n have yet to find anything pertaining to an upper bound on the number of entries within a zip&nbsp;in the documentation.&nbsp; I don't get why the entries would be limited to a 16-bit value but there's a lot of things in life I don't understand.&nbsp; I will\r\n continue to look into this and post what I get but any assistance would be greatly appreciated.</p>\r\n<p>ERROR:</p>\r\n<p>&gt;[ERROR] Zipping process failed:<br>\r\nIonic.Zip.ZipException: The number of entries is 65535 or greater. Consider setting the UseZip64WhenSaving property on the ZipFile instance.<br>\r\n&nbsp;&nbsp; at Ionic.Zip.ZipFile.Save()<br>\r\n&nbsp;&nbsp; at Ionic.Zip.ZipFile.Save(String fileName)<br>\r\n&nbsp;&nbsp; at Archive_App_DNZ.Module1.zipper(List`1 old_files, String target_archive_dir)</p>\r\n<p>VB (zipping part):</p>\r\n<p>ZipFileToCreate = target_archive_dir &amp; Replace(Date.Now.ToString.Substring(0, Date.Now.ToString.IndexOf(&quot; &quot;)), &quot;/&quot;, &quot;_&quot;) &amp; &quot;.zip&quot;<br>\r\nUsing zip As ZipFile = New ZipFile<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp; zip.AddFiles(old_files, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;zip.Save(ZipFileToCreate)<br>\r\nEnd Using</p>\r\n",
    "PostedDate": "2012-02-03T14:41:52.887-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "745756",
    "ThreadId": "291660",
    "Html": "<p>based on the previous posted error, I presumed that the Save method produced this error b/c it was writing over 65,535 files to the created archive file at one time.&nbsp; This led me to try and alter my code so that I'm not writing a large (&gt;65535) number of files to the zip file at one time.&nbsp; Instead, I am taking a subset of the [old_files] list and writing them incrementally; as in continue zipping 100 files at a time into a single zip file until all files are zipped.&nbsp; the summarized VB code is below (insert code snippet isn't working):</p>\n<p>&nbsp;'Zips 65,535 files and creates initial instance of zip file<br />&nbsp;Sub zipper(ByVal old_files As System.Collections.Generic.List(Of String), ByVal target_archive_dir As String)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim ZipFileToCreate As String<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim temp_old_files As New System.Collections.Generic.List(Of String)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim list_max As Integer<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim zip_count As Integer = 0</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If old_files.Count &gt; 65535 Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list_max = 65535<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list_max = old_files.Count<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp_old_files.AddRange(old_files.GetRange(0, list_max))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; old_files.RemoveRange(0, list_max)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ZipFileToCreate = target_archive_dir &amp; Replace(Date.Now.ToString.Substring(0, Date.Now.ToString.IndexOf(\" \")), \"/\", \"_\") &amp; \".zip\"</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using zip As ZipFile = New ZipFile<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.AddFiles(temp_old_files, \"\")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.Save(ZipFileToCreate)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp_old_files.Clear()</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If old_files.Count &gt; 0 Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip_count = list_max + zipper_add(old_files, ZipFileToCreate)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip_count = list_max<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log_text = log_text &amp; vbTab &amp; \"&gt; \" &amp; zip_count &amp; \" Files Archived.\" &amp; vbCrLf</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch e As Exception<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log_text = log_text &amp; vbCrLf &amp; vbTab &amp; \"&gt;[ERROR] Zipping process failed:\" &amp; vbCrLf &amp; e.ToString()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(\"&gt;[ERROR] Zipping process failed: {0}\", e.ToString())<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try</p>\n<p>&nbsp;&nbsp;&nbsp; End Sub</p>\n<p>&nbsp;'opens existing zip file and add up to 65,535 files into at a time<br />&nbsp;&nbsp;&nbsp; Function zipper_add(ByVal old_files As System.Collections.Generic.List(Of String), ByVal existing_zip As String)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim temp_old_files As New System.Collections.Generic.List(Of String)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim list_max As Integer<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim zip_count As Integer = 0</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If old_files.Count &gt; 65535 Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list_max = 65535<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list_max = old_files.Count<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp_old_files.AddRange(old_files.GetRange(0, list_max))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; old_files.RemoveRange(0, list_max)</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using zip As ZipFile = ZipFile.Read(existing_zip)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.AddFiles(temp_old_files, \"\")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.Save(existing_zip)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp_old_files.Clear()</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If old_files.Count &gt; 0 Then<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip_count = list_max + zipper_add(old_files, existing_zip)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip_count = list_max<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If</p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return zip_count<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch e As Exception<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log_text = log_text &amp; vbCrLf &amp; vbTab &amp; \"&gt;[ERROR] Zipping process failed:\" &amp; vbCrLf &amp; e.ToString()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(\"&gt;[ERROR] Zipping process failed: {0}\", e.ToString())<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try</p>\n<p>&nbsp;&nbsp;&nbsp; End Function</p>\n<p>It could be \"cleaner\" i know but I'll worry about that when I figure out the solution to my problem. The upper bound in the above code is 65,535 but I tried 100;1,000;and 60,000 and all results were the same.&nbsp;Anyway, this method results in the EXACT same error as before.&nbsp; This leads me to conclude that the Save method gets ticked off when trying to write any zip file that contains &gt;65,535 files.&nbsp; Is this normal or am I not considering something? For the time being I may just have to create multiple zip files for zipping folders that contain over 65,535 files in them.&nbsp; To be continued...</p>",
    "PostedDate": "2012-02-07T12:52:33.78-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "747895",
    "ThreadId": "291660",
    "Html": "<p>OH THE PAIN OF IGNORANCE!!!!</p>\r\n<p>I figued out my problem.&nbsp; Turns out that if I would have actually read the \"<strong>Create a Zip archive that uses ZIP64 extensions...\" </strong>paragraph on the examples page all of this could have been avoided.&nbsp; I honestly just skimmed over it thinking \"64\" anything doesn't pertain to me b/c I'm on a 32-bit machine...oh, I couldn't have been more wrong and more ignorant about zip files! I'm about to test my application using the <span class=\"identifier\">UseZip64WhenSaving property set to \"asnecessary\" and go from there... hopefully my post sheds some light on the zip file limitations to others who need to be slapped in the face by ignorance! On my way...</span></p>",
    "PostedDate": "2012-02-08T14:06:40.887-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]