[
  {
    "Id": "92715",
    "ThreadId": "27792",
    "Html": "<p>Someone wrote: <br>\r\nI would like to create a zip with some files, and a couple of folders and sub folders, but when I do this, it is copying the entire directory breakdown. Only the files in these folders are copied, but it includes the entire directory location in the zip... How can I fix this?<br>\r\n<br>\r\nHere is the code I am using:</p>\r\n<blockquote style=\"font-size:11pt;font-family:courier new\">\r\n<pre>try\r\n{\r\n  using (ZipFile zip = new ZipFile(DatabaseCBFilePathTB1.Text + @&quot;\\Backup.zip&quot;))\r\n  {\r\n    zip.AddFile(Environment.CurrentDire<wbr>ctory + @&quot;\\DB.accdb&quot;);\r\n    zip.AddDirectory(Environment.Curren<wbr>tDirectory + @&quot;\\Files&quot;);\r\n    zip.Save();\r\n  }\r\n}\r\n</pre>\r\n</blockquote>\r\n<p>Any help and information is greatly appreciated.<br>\r\n<br>\r\nThanks Again, </p>\r\n",
    "PostedDate": "2008-05-15T08:34:30.773-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "92717",
    "ThreadId": "27792",
    "Html": "<p>Couple ways to do this</p>\r\n<ol>\r\n    <li>There's an override on the AddFile() method that allows you to explicitly specify the directory within the zip archive, to use for that entry.  Likewise for AddDirectory().  If you want a flat directory space, then you can specify &quot;&quot; (empty string, not null/nothing) for that parameter.  Check the doc. </li>\r\n    <li>change to the directory that contains the file using \r\n    <p>            System.IO.Directory.SetCurrentDirectory(whatever);</p>\r\n    <p> , then call AddFile() with an unqualified pathname.  </p>\r\n    </li>\r\n</ol>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2008-05-15T08:38:43.59-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]