title: System.IO.Compression.ZipFile Multiple Directories
body: <p>I can get this to work if I set up an array for my <code>$destination</code> but this creates a seperate .zip for each directory selected.</p>
  
  <p>How can I select every directory and zip them under a single destination instead of multiple destination files? Here is my code:</p>
  
  <pre><code>$type = "*.txt"
  $destination = "LogsBackup.zip"
  
  Add-Type -Assembly "System.IO.Compression.FileSystem" ;
  
  $_sources = dir c:\Logs\$type -Recurse | Select Directory -Unique | 
              Out-GridView -OutputMode Multiple |
              Select @{Name="Path";Expression={$_.Directory -As [string]}} 
  
  for ($i = 0; $i -lt $_sources.Length; $i++)
  {
      $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
      [System.IO.Compression.ZipFile]::CreateFromDirectory( $_sources[$i].Path , $destination)
  }
  </code></pre>
  
  <p>I want to keep my <code>Out-GridView</code> option the way it is so if it's a single directory or multiple I can select them and store them as an array.</p>