Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (15 sloc) 627 Bytes
[CmdletBinding()]
Param(
[string]$ZIPFileName,
[string]$NewFileToAdd
)
try {
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null
$zip = [System.IO.Compression.ZipFile]::Open($ZIPFileName,"Update")
$FileName = [System.IO.Path]::GetFileName($NewFileToAdd)
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip,$NewFileToAdd,$FileName,"Optimal") | Out-Null
$Zip.Dispose()
Write-Host "Successfully added $NewFileToAdd to $ZIPFileName "
} catch {
Write-Warning "Failed to add $NewFileToAdd to $ZIPFileName . Details : $_"
}