2

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

4

1 回答 1

3

在这里我找到了一个解决方案,解决了我的问题:

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

但我仍然不知道,最好和最快的解决方法是什么。

于 2011-11-24T08:03:48.837 回答