comparison deploy/win/zip.ps1 @ 385:96e5adab61c2

Toward making Windows zip
author Chris Cannam
date Mon, 08 Jun 2020 14:46:32 +0100
parents
children 0a45b9debc30
comparison
equal deleted inserted replaced
384:c9b2dca061a6 385:96e5adab61c2
1
2 Set-StrictMode -Version 2.0
3 $ErrorActionPreference = "Stop"
4
5 if ($args.length -ne 2) {
6 echo "Usage: zip target.zip sourcedir"
7 exit 2
8 }
9
10 $sourcename = $args[1]
11 $targetname = $args[0]
12
13 $source = (Resolve-Path $sourcename)
14
15 if ([System.IO.Path]::IsPathRooted($targetname)) {
16 $target = $targetname
17 } else {
18 $target = "$pwd\$targetname"
19 }
20
21 echo "Compressing from $source to $target..." | Out-Host
22
23 [io.compression.zipfile]::CreateFromDirectory($source, $target)
24