![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Extract ZIP Files Without Preserving Directory Paths Using DiscardPathsSee more Zip Examples This example demonstrates how to use the When This is useful when:
Suppose the ZIP archive contains: Normally, extracting the ZIP would create: But when The stored ZIP directory paths are discarded during extraction.
integer li_rc integer li_Success oleobject loo_Zip integer li_NumFilesUnzipped li_Success = 0 li_Success = 0 loo_Zip = create oleobject li_rc = loo_Zip.ConnectToNewObject("Chilkat.Zip") if li_rc < 0 then destroy loo_Zip MessageBox("Error","Connecting to COM object failed") return end if // Open an existing ZIP archive. li_Success = loo_Zip.OpenZip("example.zip") if li_Success = 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip return end if // Discard stored ZIP paths during extraction. // // When DiscardPaths = 1, all files are extracted // directly into the target directory without recreating // the ZIP directory structure. loo_Zip.DiscardPaths = 1 // Extract all files to the output directory. // // Even if the ZIP contains: // // docs/readme.txt // docs/manual.pdf // images/logo.png // // The extracted files become: // // c:/output/readme.txt // c:/output/manual.pdf // c:/output/logo.png // li_NumFilesUnzipped = loo_Zip.Unzip("c:/output") if li_NumFilesUnzipped < 0 then Write-Debug loo_Zip.LastErrorText destroy loo_Zip return end if Write-Debug "Number of files extracted = " + string(li_NumFilesUnzipped) loo_Zip.CloseZip() Write-Debug "Files extracted successfully." destroy loo_Zip |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.