Skip to content

Instantly share code, notes, and snippets.

@sharif0777
Forked from stefanteixeira/ZipFolder.ps1
Created May 30, 2017 06:39
Show Gist options
  • Save sharif0777/b6d17eb40167c45649ba4e1cd808934e to your computer and use it in GitHub Desktop.
Save sharif0777/b6d17eb40167c45649ba4e1cd808934e to your computer and use it in GitHub Desktop.
PowerShell script to compress a directory to a .zip file
$source = "C:\Path\To\Directory"
$destination = "C:\Path\To\Zip\file.zip"
If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment