PSBeginner
PSBeginner

Reputation: 771

Save() never gets finished

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

Upvotes: 2

Views: 560

Answers (1)

PSBeginner
PSBeginner

Reputation: 771

Here I found a solution, that solves my problem:

http://dotnetzip.codeplex.com/discussions/276149

But still I do not know, what would be the best and fastest workaround.

Upvotes: 3

Related Questions