2020-04-23 09:58:18 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Unpack *.7z file
|
|
|
|
#>
|
2020-04-23 15:42:48 +00:00
|
|
|
function Extract-SevenZipArchive {
|
2020-04-23 09:58:18 +00:00
|
|
|
param(
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
[String]$ArchivePath,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
[String]$OutputDirectory
|
|
|
|
)
|
|
|
|
|
|
|
|
Write-Debug "Extract $ArchivePath to $OutputDirectory"
|
|
|
|
7z x $ArchivePath -o"$OutputDirectory" -y | Out-Null
|
2020-04-23 15:42:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function Create-SevenZipArchive {
|
|
|
|
param(
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
[String]$SourceFolder,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
[String]$ArchivePath,
|
|
|
|
[String]$ArchiveType = "zip",
|
|
|
|
[String]$CompressionLevel = 5
|
|
|
|
)
|
|
|
|
|
|
|
|
$ArchiveTypeArgument = "-t${ArchiveType}"
|
|
|
|
$CompressionLevelArgument = "-mx=${CompressionLevel}"
|
|
|
|
|
|
|
|
Push-Location $SourceFolder
|
|
|
|
Write-Debug "7z a $ArchiveTypeArgument $CompressionLevelArgument $ArchivePath @$SourceFolder"
|
|
|
|
7z a $ArchiveTypeArgument $CompressionLevelArgument $ArchivePath $SourceFolder\*
|
|
|
|
Pop-Location
|
2020-04-23 09:58:18 +00:00
|
|
|
}
|