title: PowerShell v4 - Archiving and Extracting New & Existing Zip Files
body: <p>I'm aiming to create PowerShell scripts that will:</p>
  
  <ol>
  <li>Extract multiple zip files in a directory</li>
  <li>Create archive zip files for multiple file types with the ability to add files to the zip if it already exists.</li>
  </ol>
  
  <p>I cannot use <code>Compress-Archive</code> / <code>Expand-Archive</code> in PowerShell v4</p>
  
  <p>This extracts test.zip but I need it to extract multiple .zip files at once using a wildcard:</p>
  
  <pre><code>[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\test.zip', 'C:\') 
  </code></pre>
  
  <p>This creates the zip file in the directory <code>"C:\$year\$month\$folder.zip"</code>, When I run the same script again with a new 'sample' file, it says it already exists.</p>
  
  <p>I need to amend the script to say 'If the zip file exists, add the file to it'.</p>
  
  <pre><code>$year = Get-Date -Format 'Yr. yyyy'
  $month = Get-Date -Format 'MMMM'
  $folder = Get-Date -Format 'TESTddMMyyyy'
  $source = "C:\$year\$month\$folder"
  $destination = "C:\$year\$month\$folder.zip"
  New-Item -ItemType Directory -Path "C:\$year\$month\$(Get-Date -Format 'TESTddMMyyyy')"
  Move-Item 'C:\SAMPLE*' "C:\$year\$month\$(Get-Date -Format 'TESTddMMyyyy')"
  Add-Type -assembly "system.io.compression.filesystem"
  [system.io.compression.zipfile]::CreateFromDirectory($source, $destination)
  $compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
  Remove-Item $source -Force -Recurse
  </code></pre>