Sample code for 30+ languages & platforms
PowerShell

Transition from ZipEntry.NextEntry to ZipEntry.GetNext

Provides instructions for replacing deprecated NextEntry method calls with GetNext.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

# ------------------------------------------------------------------------
# The NextEntry method is deprecated.
# See below or code showing how to rewrite using EntryAt/GetNext

$zip = New-Object Chilkat.Zip

$success = $zip.OpenZip("qa_data/zips/xml_files.zip")
if ($success -ne $true) {
    $($zip.LastErrorText)
    exit
}

$entry = $zip.FirstEntry()
if ($zip.LastMethodSuccess -eq $false) {
    $("This zip archive is empty.")
    exit
}

$finished = $false
while ($finished -eq $false) {

    if ($entry.IsDirectory -eq $false) {
        $($entry.FileName)
    }
    else {
        $("(directory) " + $entry.FileName)
    }

    $next = $entry.NextEntry()
    if ($entry.LastMethodSuccess -eq $false) {
        $finished = $true
    }

    $entry = $next
}

$zip.CloseZip()

$("----")

# ------------------------------------------------------------------------
# Do the equivalent using EntryAt/GetNext.

$success = $zip.OpenZip("qa_data/zips/xml_files.zip")

$ze = New-Object Chilkat.ZipEntry
$zip.EntryAt(0,$ze)

$entryValid = $true
while ($entryValid -eq $true) {

    if ($ze.IsDirectory -eq $false) {
        $($ze.FileName)
    }
    else {
        $("(directory) " + $ze.FileName)
    }

    $entryValid = $ze.GetNext()
}

$zip.CloseZip()