[
  {
    "Id": "482715",
    "ThreadId": "224236",
    "Html": "<p>hi!</p>\r\n<p>I am new using the DoNetZip Library. I am have a simple code to zip a folder:</p>\r\n<p><span style=\"font-size:x-small\"><span style=\"font-size:x-small\">\r\n<p>&nbsp;<span style=\"color:#0000ff;font-size:x-small\"><span style=\"color:#0000ff;font-size:x-small\">using</span></span><span style=\"font-size:x-small\"> (</span><span style=\"color:#2b91af;font-size:x-small\"><span style=\"color:#2b91af;font-size:x-small\">ZipFile</span></span><span style=\"font-size:x-small\"> zip = </span><span style=\"color:#0000ff;font-size:x-small\"><span style=\"color:#0000ff;font-size:x-small\">new</span></span><span style=\"font-size:x-small\"> </span><span style=\"color:#2b91af;font-size:x-small\"><span style=\"color:#2b91af;font-size:x-small\">ZipFile</span></span><span style=\"font-size:x-small\">())</span><span style=\"font-size:x-small\"> </span>\r\n<div>\r\n<div><span style=\"font-size:x-small\">{</span></div>\r\n</div>\r\n</p>\r\n</span></span></p>\r\n<div><span style=\"font-size:x-small\">&nbsp;</span><span style=\"font-size:x-small\"><span style=\"font-size:x-small\"><span style=\"font-size:x-small\"><span style=\"font-size:x-small\"><span style=\"color:#0000ff;font-size:x-small\"><span style=\"color:#0000ff;font-size:x-small\">try</span></span></span></span><span style=\"font-size:x-small\">{</span></span></span><span style=\"font-size:x-small\"><span style=\"font-size:x-small\">\r\n<p>zip.AddDirectory(<span style=\"color:#a31515;font-size:x-small\"><span style=\"color:#a31515;font-size:x-small\">@&quot;C:\\Example\\Example2&quot;</span></span><span style=\"font-size:x-small\">);</span><span style=\"font-size:x-small\"><span style=\"font-size:x-small\"> //I want to zip the folder Example 2</span></span></p>\r\n</span></span>\r\n<p><span style=\"font-size:x-small\"><span style=\"font-size:x-small\">\r\n<p>&nbsp;<span style=\"color:#008000;font-size:x-small\"><span style=\"color:#008000;font-size:x-small\">zip.Save(&quot;Example2.zip&quot;); //New zip information</span></span></p>\r\n</span></span></p>\r\n</div>\r\n<p>\r\n<p>&nbsp;</p>\r\n</p>\r\n<p><span style=\"color:#008000;font-size:x-small\">&nbsp;</span><span style=\"font-size:x-small\"><span style=\"font-size:x-small\">&nbsp;</span></span><span style=\"font-size:x-small\">}</span></p>\r\n<p><span style=\"font-size:x-small\">\r\n<p>&nbsp;<span style=\"color:#0000ff;font-size:x-small\"><span style=\"color:#0000ff;font-size:x-small\">catch</span></span><span style=\"font-size:x-small\"> (</span><span style=\"color:#2b91af;font-size:x-small\"><span style=\"color:#2b91af;font-size:x-small\">Exception</span></span><span style=\"font-size:x-small\"> e)</span><span style=\"font-size:x-small\"> <span style=\"font-size:x-small\">{&nbsp; </span></span></p>\r\n<p><span style=\"font-size:x-small\"><span style=\"font-size:x-small\"><span style=\"font-size:x-small\">&nbsp;</span></span></span>................</p>\r\n<p>&nbsp;</p>\r\n</span></p>\r\n<p>\r\n<p><span style=\"font-size:x-small\">\r\n<p>}</p>\r\n<p>}</p>\r\n</span></p>\r\n<p>&nbsp;I always get &quot;Example2.zip&quot; under the my projects files(bin)&nbsp;of&nbsp; Visual Studio.</p>\r\n<p>There is a way to&nbsp;change the&nbsp;destination path and that It creates under the same&nbsp;&nbsp;directory; in this example under &quot;C:\\Examples\\Example2.zip&quot; ?</p>\r\n<p>&nbsp;</p>\r\n<p>Thank you!</p>\r\n</p>",
    "PostedDate": "2010-08-20T05:06:24.343-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "482731",
    "ThreadId": "224236",
    "Html": "<p>Hi!</p>\r\n<p>I found the solution... :)</p>\r\n<p>it&acute;s just: &nbsp;zip.save(<span style=\"color:#a31515;font-size:x-small\"><span style=\"color:#a31515;font-size:x-small\">@&quot;C:\\Example\\&quot;+&quot;Example2.zip&quot;</span></span><span style=\"font-size:x-small\">)</span></p>\r\n<p><span style=\"font-size:x-small\">&nbsp;</span></p>\r\n<p><span style=\"font-size:x-small\">Greetings!</span></p>",
    "PostedDate": "2010-08-20T05:33:04.513-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "482742",
    "ThreadId": "224236",
    "Html": "<p>Ya, what you have will work, but:</p>\r\n<ol>\r\n<li>There's no need to do string concatenation, like so: &quot;c:\\Example\\&quot; + &quot;Example2.zip&quot; . &nbsp;You can just specify the full path in one string: &quot;c:\\Example\\Example2.zip&quot;.&nbsp;</li>\r\n<li>If you DO use string concatenation to build paths, I suggest the base library function&nbsp;Path.Concat()</li>\r\n<li>Saving a zip file into the same folder that you are zipping, results in undefined behavior.&nbsp;</li>\r\n</ol>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-08-20T05:53:32.833-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "482764",
    "ThreadId": "224236",
    "Html": "<p>Hi Cheeso!</p>\r\n<p>&nbsp;</p>\r\n<p>Thank you for your advice! However I didn&acute;t understood the 3rd point. Why it results in undefined behavior?</p>",
    "PostedDate": "2010-08-20T06:24:06.05-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "482993",
    "ThreadId": "224236",
    "Html": "<p>You're saving a zip to the directory that you are zipping.  I suppose &quot; undefined&quot; is the wrong word. What I mean is non- idempotent.  On the first attempt it will work.  On succesive saves, when the zip already exists, the resulting zip may contain file entries that are not valid.</p>",
    "PostedDate": "2010-08-20T20:22:52.803-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "484548",
    "ThreadId": "224236",
    "Html": "<p>ok!&nbsp; now I understand what you mean :)</p>\r\n<p>Greetings! and Thank u :)</p>",
    "PostedDate": "2010-08-25T01:18:54.19-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "513245",
    "ThreadId": "224236",
    "Html": "\r\n<p>hi, i got a question about the zip file destination.</p>\r\n<p>i zip a file named &quot;123.txt&quot;, then i set the destination as &quot;C:\\Program File\\abc.zip&quot;..but when i extract the folder in Program File, it wil extract the folder with full path i set previously, which mean the extracted file name is &quot;Program File&quot;, the full\r\n path of my file 123.txt is &quot;C:\\Program File\\Program File\\123.txt&quot;..if i set the destination name longer, then, it will extract my file in multiple layer, for example, destination is &quot;C:\\Program File\\abc\\efg\\abc.zip&quot;, after i extract it in my Program File,\r\n the 123.txt will have a path like this &quot;C:\\Program File\\Program File\\abc\\efg\\123.txt&quot;..what i want is only the file extract to Program File but not multi layers folder.</p>\r\n<p>can anyone help me? thank you very much....</p>\r\n<p>&nbsp;</p>\r\n<p>urgent..</p>\r\n",
    "PostedDate": "2010-10-27T02:03:14.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "515273",
    "ThreadId": "224236",
    "Html": "\r\n<p>Important: open a new thread if you have a new question.</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2010-10-31T19:30:05.37-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]