Skip to content

Instantly share code, notes, and snippets.

@constructor-igor
Last active August 29, 2015 14:10
Show Gist options
  • Save constructor-igor/85634eaf0d08cac4de1a to your computer and use it in GitHub Desktop.
Save constructor-igor/85634eaf0d08cac4de1a to your computer and use it in GitHub Desktop.
create Zip file (powershell)
#
# http://stackoverflow.com/questions/1153126/how-to-create-a-zip-archive-with-powershell
#
#
# $zipFileName contains path to new .zip file
# $sourceDir contains path to folder with source data
#
ZipFiles $zipFileName $sourceDir
function ZipFiles([String] $zipfilename, [String] $sourcedir)
{
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcedir, $zipfilename, $compressionLevel, $false)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment