Created
March 10, 2020 17:40
-
-
Save phargogh/f17dbad289a45da3f8324bdb8f163878 to your computer and use it in GitHub Desktop.
Powershell shim for replicating zip -r
This file contains hidden or 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
# A wrapper around the powershell equivalent of zipping functionality. | |
# This script takes 3 parameters: | |
# --> whether to recurse (this is ignored, but we have to take it anyways for compatibility) | |
# --> The target archive path | |
# --> The folder to zip. | |
# | |
param ( | |
[Parameter(Mandatory=$false, ValueFromPipeline=$false, ParameterSetName='r')] | |
[switch] | |
$recurse, | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[String[]] | |
$target_file, | |
[Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
[String[]] | |
$directory | |
) | |
# Calling the powershell-equivalent of GNU Zip | |
Compress-Archive ` | |
-CompressionLevel Optimal ` | |
-DestinationPath "$target_file" ` | |
-Path "$directory" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment