![]() |
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
(PureBasic) Extract Only Newer Files Using UnzipNewerSee more Zip Examples This example demonstrates how to use the This is useful for:
Suppose the ZIP archive contains: And suppose the target extraction directory already contains: If the ZIP version of If the existing Files that do not yet exist on disk are extracted normally. The
IncludeFile "CkZip.pb" Procedure ChilkatExample() success.i = 0 zip.i = CkZip::ckCreate() If zip.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; Open an existing ZIP archive. success = CkZip::ckOpenZip(zip,"qa_data/zips/applicationUpdate.zip") If success = 0 Debug CkZip::ckLastErrorText(zip) CkZip::ckDispose(zip) ProcedureReturn EndIf ; ------------------------------------------------------------ ; Extract only ZIP entries that are newer than the ; corresponding files already existing on disk. ; ; Existing files that are already up-to-date are skipped. ; numFilesUnzipped.i = CkZip::ckUnzipNewer(zip,"c:/temp/app") If numFilesUnzipped < 0 Debug CkZip::ckLastErrorText(zip) CkZip::ckDispose(zip) ProcedureReturn EndIf Debug "Number of files extracted = " + Str(numFilesUnzipped) Debug "" ; ------------------------------------------------------------ ; Example behavior: ; ; ZIP contains: ; ; docs/readme.txt ; images/logo.png ; data/config.json ; ; Existing filesystem files: ; ; c:/temp/app/docs/readme.txt ; c:/temp/app/images/logo.png ; ; If the ZIP version of docs/readme.txt is newer, ; it will overwrite the existing file. ; ; If c:/temp/app/images/logo.png is already newer, ; it will be skipped. ; ; data/config.json will be extracted if it does not ; already exist. ; CkZip::ckCloseZip(zip) Debug "UnzipNewer completed successfully." CkZip::ckDispose(zip) ProcedureReturn EndProcedure |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.