title: How to compress multiple files into one zip with PowerShell?
body: <p>I want to compress multiple files into one zip.</p>
  
  <p>I am stuck with this at the moment:</p>
  
  <pre><code>Get-ChildItem -path C:\logs -Recurse | Where {$_.Extension -eq ".csv" -and $_.LastWriteTime -lt (Get-Date).AddDays(-7)} | write-zip -level 9 -append ($_.LastWriteTime).zip | move-item -Force -Destination {
      $dir = "C:\backup\archive"
      $null = mkdir $dir -Force
      "$dir\"
  }
  </code></pre>
  
  <p>I get this exception</p>
  
  <blockquote>
    <p>Write-Zip : Cannot bind argument to parameter 'Path' because it is null.</p>
  </blockquote>
  
  <p>This part is the problem:</p>
  
  <pre><code>write-zip -level 9 -append ($_.LastWriteTime).zip
  </code></pre>
  
  <p>I have never used powershell before but i have to provide a script, I can't provide a c# solution.</p>