[
  {
    "Id": "233133",
    "ThreadId": "68537",
    "Html": "<p>I have spent hours trying to figure this out, and it's something that is soooo simple with wzzip. &nbsp;I simply want to take a group of files and zip them up one at a time, each in their own zip file. &nbsp;But when I open the zip file, I only want that one file in there with NO directory tree. &nbsp;Any help would be greatly apprecitated.</p>\r\n<p>Here's my powershell script (at least the dotnetzip portion) with it as close as I could get it. &nbsp;I don't want the $MysteriousFolderName in there at all, but that's all I could figure out:</p>\r\n<p>&nbsp;</p>\r\n<pre>foreach ($file in gci $LogPath -filter $FileType -recurse | where{$_.LastWriteTime -lt [DateTime]::Now.AddDays($DaysOld)})\r\n    {\r\n        $FileName = $File.FullName\r\n        $ZipName = $File.FullName + &quot;.zip&quot;\r\n        $MysteriousFolderName = ($File.DirectoryName).split(&quot;\\&quot;)\r\n        $directoryToZip = $File.DirectoryName\r\n        \r\n        $zipfile =  new-object Ionic.Zip.ZipFile\r\n        $e = $zipfile.AddSelectedFiles($FileName, $directoryToZip, $MysteriousFolderName[5])\r\n        $zipfile.Save($ZipName)\r\n        $zipfile.Dispose()\r\n    }</pre>\r\n<p>Thanks,<br>Gary</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\">foreach ($file in gci $LogPath -filter $FileType -recurse | where{$_.LastWriteTime -lt [DateTime]::Now.AddDays($DaysOld)})</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp;{</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$FileName = $File.FullName</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$ZipName = $File.FullName + &quot;.zip&quot;</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$MysteriousFolderName = ($File.DirectoryName).split(&quot;\\&quot;)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$directoryToZip = $File.DirectoryName</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$zipfile = &nbsp;new-object Ionic.Zip.ZipFile</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$e = $zipfile.AddSelectedFiles($FileName, $directoryToZip, $MysteriousFolderName[5])</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$zipfile.Save($ZipName)</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$zipfile.Dispose()</div>\r\n<div id=\"_mcePaste\" style=\"left:-10000px;top:0px;width:1px;height:1px;overflow-x:hidden;overflow-y:hidden\">&nbsp;&nbsp; &nbsp;}</div>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-10T08:10:09.72-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "233144",
    "ThreadId": "68537",
    "Html": "<pre>foreach ($file in gci $LogPath -filter $FileType -recurse | where{$_.LastWriteTime -lt [DateTime]::Now.AddDays($DaysOld)})\r\n{\r\n    $FileName = $File.FullName\r\n    $ZipName = $File.FullName + &quot;.zip&quot;\r\n    $zip = new-object Ionic.Zip.ZipFile\r\n    $zip.AddFile($FileName, &quot;&quot;);\r\n    $zip.Save($ZipName)\r\n    $zip.Dispose()\r\n}</pre>",
    "PostedDate": "2009-09-10T08:20:42.457-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "233163",
    "ThreadId": "68537",
    "Html": "<p>Thank you so much, that worked perfectly!</p>\r\n<p>Gary</p>",
    "PostedDate": "2009-09-10T09:03:27.58-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]