[
  {
    "Id": "98195",
    "ThreadId": "29471",
    "Html": "First - thanks to Chesso for the great work and effort thus far.<br>\r\n<br>\r\nI need to add a large amount of files to a zip file (the file sizes are very small), but I need to verify which files get added successfully. I am unable to add files successfully to an existing .zip archive (using version 1.5.0.7). Simple example:<br>\r\n<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip As New ZipFile(&quot;D:\\Data_Archive.zip&quot;) 'Create initial archive<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.AddItem(&quot;D:\\Data.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.Save()<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip2 As New ZipFile&nbsp; 'Start adding new files to zip file.<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.UpdateItem(&quot;D:\\Data2.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.Save(&quot;D:\\Data_Archive.zip&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n<br>\r\nThis code generates &quot;Unable to move the replacement file to the file to be replaced. The file to be replaced has retained its original name.&quot;. The temp directory is set correctly. I am I overlooking something simple, or should I be going about this a different way? Any suggestions are welcome.<br>\r\n<br>\r\nJon<br>\r\n",
    "PostedDate": "2008-06-11T09:05:47.25-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "98206",
    "ThreadId": "29471",
    "Html": "Hey JonBoy, <br>\r\n<br>\r\nYes, this may be a bug.<br>\r\n<br>\r\nI think the error you are getting is telling you that that the original zip file &quot;D:\\Data_Archive.zip&quot;&nbsp; is not being overwritten.<br>\r\nThe documentation for the Save(&quot;filename&quot;) method says:&nbsp;&nbsp;&quot;Existing files will be overwritten with great prejudice.&quot;&nbsp; It seems this is not the actual behavior. <br>\r\n<br>\r\nBut in addition to the bug, I think there is some confusion on your part regarding how to use the library. <br>\r\n<br>\r\nYour second stanza opens a new ZipFile, a totally new zipfile.&nbsp; The no-argument constructor you use (New ZipFile)&nbsp; says - this is going to be a new zip file. <br>\r\nSo in fact you are not Updating any entries in an existing zipfile. You are creating a totally new, independent zip file. <br>\r\nAnd by calling UpdateItem() on that totally new zipfile, you are adding the item to the zipfile. <br>\r\n<br>\r\nOk, then you try to save into a zip archive that already exists.&nbsp;&nbsp; The file is not being overwritten.&nbsp; This is the bug.&nbsp;&nbsp; <br>\r\n<br>\r\nif you want to update a zip file you would do something like this:&nbsp;<br>\r\n<br>\r\n<span style=\"font-family:Courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip2 As New ZipFile&nbsp; 'Start adding new files to a new zip file.<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.AddItem(&quot;D:\\Data.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.Save(&quot;D:\\Data_Archive.zip&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip As New ZipFile(&quot;D:\\Data_Archive.zip&quot;) 'Open the existing<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.UpdateItem(&quot;D:\\Data2.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.Save()<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n</span><br>\r\nOr, another option is like this: <br>\r\n<br>\r\n<span style=\"font-family:Courier\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip2 As New ZipFile<span style=\"font-family:Courier\">(&quot;D:\\Data_Archive.zip&quot;)</span>&nbsp; 'open a new or existing archive.<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.UpdateItem(&quot;D:\\Data.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.Save(&quot;D:\\Data_Archive.zip&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using oZip As New ZipFile(&quot;D:\\Data_Archive.zip&quot;) 'open the existing archive<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip2.UpdateItem(&quot;D:\\Data2.bin&quot;, &quot;&quot;)<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oZip.Save()<br>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>\r\n</span><br>\r\n",
    "PostedDate": "2008-06-11T09:51:41.483-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "98207",
    "ThreadId": "29471",
    "Html": "Ahh, the bug I think has to do with using a different volume for the temp file, versus the final file. <br>\r\n<br>\r\nThis is workitem&nbsp;5284<br>\r\n<br>\r\n<a href=\"http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=5284\">http://www.codeplex.com/DotNetZip/WorkItem/View.aspx?WorkItemId=5284</a><br>\r\n",
    "PostedDate": "2008-06-11T09:53:49.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "98218",
    "ThreadId": "29471",
    "Html": "Thanks for the quick response Cheeso. <br>\r\n<br>\r\nI did notice that line in the documentation as well, but it seemed to go against what I found in discussion http://www.codeplex.com/DotNetZip/Thread/View.aspx?ThreadId=28509 when the functionality was added.<br>\r\n<br>\r\nThe clarification on the ctors and .save method for new vs. existing archives makes sense now. Thanks for creating the work item for the .temp file and archive being on a different directory.<br>\r\n<br>\r\n<br>\r\n",
    "PostedDate": "2008-06-11T10:41:53.333-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "98232",
    "ThreadId": "29471",
    "Html": "<blockquote>I did notice that line in the documentation as well, but it seemed to go against what I found in discussion http://www.codeplex.com/DotNetZip/Thread/View.aspx?ThreadId=28509 when the functionality was added. </blockquote><br>\r\nWe seem to have a little foncusion here.<br>\r\nThe discussion<br>\r\n<a href=\"http://www.codeplex.com/DotNetZip/Thread/View.aspx?ThreadId=28509\">http://www.codeplex.com/DotNetZip/Thread/View.aspx?ThreadId=28509</a> <br>\r\n<br>\r\nis referring to updating entries <em>within a zipfile</em>.&nbsp; The line in the documentation you are commenting on&nbsp; - I think you mean the part that says -&nbsp;&nbsp;&quot;Existing files will be overwritten with great prejudice.&quot;&nbsp;&nbsp;&nbsp;deals with updating a zip archive <em>on the disk</em>.&nbsp; <br>\r\n<br>\r\nThey are related but not quite&nbsp;the same thing.&nbsp; What I mean is - <br>\r\na common scenario will be to read in an existing ZipFile, then update items in the zip file, then save the zipfile to the disk.&nbsp;&nbsp; I think this is what you were trying to do, JonBoy. <br>\r\nThe discussion at 28509 said we have now added UpdateFile() and UpdateItem() as methods on the ZipFile class. That takes care of &quot;updating items in the zip file&quot;.&nbsp; The thing you are doing is saving the updated file, back to the same place.&nbsp;&nbsp; This is the part that is covered by&nbsp;&nbsp;&quot;Existing files will be overwritten with great prejudice.&quot;&nbsp;&nbsp;&nbsp;<br>\r\n<br>\r\nExcept there was a bug dealing with multiple volumes (C:\\ versus d:\\). <br>\r\n<br>\r\nAs I said I put a fix into the source for this.&nbsp; If you want to workaround the problem with an existing binary, set the TempFileFolder to be on a disk that is the same as the disk you are saving your ZipFile to.&nbsp; Eg, d:\\temp.&nbsp; If you want the fix, you can build the latest source yourself or wait for a new binary from me. <br>\r\n<br>\r\nMake sense?<br>\r\n",
    "PostedDate": "2008-06-11T11:56:40.777-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "98237",
    "ThreadId": "29471",
    "Html": "I understood the different volume issue from your previous response (I changed my files\\directories to C: and verified that). Already copied down the latest source. <br>\r\n<br>\r\n&gt;&gt; The thing you are doing is saving the updated file, back to the same\r\nplace.&nbsp;&nbsp; This is the part that is covered by&nbsp;&nbsp;&quot;Existing files will be\r\noverwritten with great prejudice.&quot;&nbsp; <br>\r\nRoger that Capt! Understood.<br>\r\n",
    "PostedDate": "2008-06-11T12:22:52.857-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]