-
-
Save sharif0777/b6d17eb40167c45649ba4e1cd808934e to your computer and use it in GitHub Desktop.
PowerShell script to compress a directory to a .zip file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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