This project is read-only.

PowerShell and creating multi-part file

Feb 3, 2011 at 2:43 PM

I'm trying to find out how to create a multi-part file using DotNetZip and PowerShell. I might be overlooking it in the documentation but if someone could point me in the right direction I would really appreciate it. The goal is to take a folder that contains very large files (Virtual Machines) in a specific directory and then zip them into multipart files along with AES encryption. Each VM which resides in it's own directory would be individually compressed and named according to the directory name.

If anyone has done something like this please share if not I can figure most of it out; just need to know how to perform the multi-part part.

Thank you!

Feb 3, 2011 at 5:25 PM

Figured it out. For those looking for the same thing here is the simplified version.



$Target = "D:\Downloads\Test"

$Destination = "D:\test"
function ZipItUp


$outputFile = [IO.FileInfo] "$Destination\$"

 $zipfile = new-object Ionic.Zip.ZipFile

$selfExtractOptions = New-Object Ionic.Zip.SelfExtractorSaveOptions

$selfExtractOptions.Flavor = [Ionic.Zip.SelfExtractorFlavor]::ConsoleApplication

$selfExtractOptions.DefaultExtractDirectory = $outputFile.Directory.FullName

 $selfExtractOptions.RemoveUnpackedFilesAfterExecute = $false

$e = $zipfile.AddDirectory("$Target\$fldr")

$zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::Always

$zipfile.MaxOutputSegmentSize = 1073741824

$zipfile.SaveSelfExtractor($outputFile.FullName, $selfExtractOptions)



foreach ($fldr in Get-ChildItem $Target)


Write-Host "Zipping up $fldr to $Destination"




Sorry for the formatting. I'm new to CodePlex and not sure how to post code snippets.