Issue extracting spanned zip created with DotNetZip

Dec 21, 2010 at 8:56 PM

When extracting a spanned ZIP created with DotNetZip using the built-in Windows 7 windows explorer ZIP extraction right click option, sometimes I get an error:


"The same volume can not be used as both the source and destination"


It doesn't happen all the time however. Currently I am running a test program that I created to try to figure out what makes this happen. I'm not sure it it is related to the number of segments created, or the size of the segments or if it is something else.

Once I have more info i'll post it back here.

My test program is written to create spanned ZIPs of a large directory (100GB) with a random segment size. The issue happened on my current test run:


Segment size: 1710869114

Number of segments: 9

Dec 22, 2010 at 3:04 AM

After some more testing, out of DotNetZip, WinZIP, 7zip, WinRAR and the built-in Windows 7 ZIP extraction, DotNetZip, WinZIP and WinRAR were the only software that could extract the spanned ZIP created by DotNetZip. For some reason 7zip and the Win7 built-in extraction could not do the extraction.


Here is my testing code. It automates the creation of spanned zips. It prompts for an input directory to ZIP and an output directory to dump test runs to of varying segment sizes. The size of the span is selected randomly.



function Get-ScriptDirectory
    $invocation = (Get-Variable MyInvocation -Scope 1).Value
    $script = [IO.FileInfo] $invocation.MyCommand.Path
    if ([IO.File]::Exists($script)) {
        Return (Split-Path $script.Fullname)
    else {
        return $null

function Show-FolderBrowser
    param (
        [string] $Prompt = "Select Directory"
    [string] $SelectedFolder = (new-object -ComObject Shell.Application).BrowseForFolder(0, $Prompt, 1).Self.Path
    if (!$SelectedFolder) {
        return $null
    if ([IO.Directory]::Exists($SelectedFolder)) {
        return [IO.DirectoryInfo] $SelectedFolder
    } else {
        return $null

$saveEvtHnd = {
    if ($_.EventType -eq [Ionic.Zip.ZipProgressEventType]::Saving_BeforeWriteEntry)
        try {
            $status = [Math]::Floor($_.EntriesSaved / $_.EntriesTotal * 100).ToString() + "% Complete"     
            Write-Progress -Id 1 -Activity "Creating: '$($_.ArchiveName)'" -Status $status -PercentComplete ($_.EntriesSaved / $_.EntriesTotal * 100)
        } catch {
            throw $_
    } elseif ($_.EventType -eq [Ionic.Zip.ZipProgressEventType]::Saving_EntryBytesRead) {
        try {
            $status = [Math]::Floor($_.BytesTransferred / $_.TotalBytesToTransfer * 100).ToString() + "% Complete"   
            Write-Progress -Id 2 -ParentId 1 -Activity "Adding file: '$($_.CurrentEntry.FileName)'" -Status $status -PercentComplete ($_.BytesTransferred / $_.TotalBytesToTransfer * 100)
        } catch {
            throw $_


$scriptHome = [IO.DirectoryInfo] (Get-ScriptDirectory)

$assem = [System.Reflection.Assembly]::LoadFrom( [IO.Path]::Combine($scriptHome, "Ionic.Zip.dll") )
$assem = [System.Reflection.Assembly]::LoadFrom( [IO.Path]::Combine($scriptHome, "Ionic.Zlib.dll") )

$inputDir = Show-FolderBrowser -Prompt "Select input directory"
$outputDir = Show-FolderBrowser -Prompt "Select output directory"

$maxAttempts = 100

$DebugPreference = "Continue"

1..$maxAttempts | % {
    $iteration = $_
    try {
        $archiveSegmentSize = [Math]::Floor((Get-Random -Minimum 1MB -Maximum 200MB))
        $name = [IO.Path]::GetFileNameWithoutExtension([IO.Path]::GetRandomFileName())
        $outFolder = [IO.DirectoryInfo] ([IO.Path]::Combine($outputDir, "$name $archiveSegmentSize"))
        $outZip = [IO.FileInfo] ([IO.Path]::Combine($outFolder, ($name + ".zip")))
        $zipfile = new-object Ionic.Zip.ZipFile
        $zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::AsNecessary
        $zipfile.MaxOutputSegmentSize = $archiveSegmentSize

    } catch {
        throw "Failed to run iteration ${iteration}. The error was: '$_'."

Read-Host "Done"

Jun 12, 2011 at 12:34 PM

this is the same problem i'm facing.. did u ever got any solution for this ??

Jun 18, 2011 at 6:04 AM

I don't believe that Windows Explorer's built-in zip capability (aka Compressed Folders) supports spanned zip files.

I could be wrong about this.  However, my understanding is consistent with what antize reported above.

Feb 3, 2014 at 11:01 PM
Edited Feb 3, 2014 at 11:02 PM
I have the same issue using DotNetZip version It does not appear to be fixed. Windows 7 does support opening spanned zip files - some files spanned using DotNetZip open just fine. Others fail with "The same volume can not be used as both the source and destination".