I try to create an archive with DotNetZip. I'm able to use AddFile method and can save and dispose the zip-file.
But when I try only to add folders with AddDirectory the following Save doesn't come to an end.
Does someone have an idea what could go wrong? I tried to append MaxOutPutSegmentSize and UseZip64WhenSaving as shown in some examples, but that didn't change anything. I tried to call Save with an explizit zip-file or not.
function ZipUp-Files ( $mychildren )
{
foreach ($o in $mychildren)
{
$e= $zipfile.AddDirectory($o.FullName,$o.fullname.substring($pwd.path.length));
}
}
$children =get-childitem -recurse -force | where-object {$_.psiscontainer} | where {$_.name -match $teststring}
[System.Reflection.Assembly]::LoadFrom("C:\dotNetZip\zip-v1.9\Release\Ionic.Zip.dll");
$zipfile = new-object Ionic.Zip.ZipFile($ziptarget);
ZipUp-Files $children
$zipfile.Save()
$zipfile.Dispose()
Thanks in advance