Last active
August 29, 2015 14:10
-
-
Save constructor-igor/85634eaf0d08cac4de1a to your computer and use it in GitHub Desktop.
create Zip file (powershell)
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
# | |
# 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