Skip to content

Instantly share code, notes, and snippets.

@sakapon
Last active October 13, 2015 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakapon/1e2f02e5277fc801eb7f to your computer and use it in GitHub Desktop.
Save sakapon/1e2f02e5277fc801eb7f to your computer and use it in GitHub Desktop.
BuildSample / Create ZIP (PowerShell)
# source directory path
if (-not ($Args[0])) { return 100 }
# target zip file path
if (-not ($Args[1])) { return 101 }
Add-Type -AssemblyName System.IO.Compression.FileSystem
$parent = [System.IO.Path]::GetDirectoryName($Args[1])
[System.IO.Directory]::CreateDirectory($parent)
[System.IO.File]::Delete($Args[1])
[System.IO.Compression.ZipFile]::CreateFromDirectory($Args[0], $Args[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment