Xbase++ Requires Chilkat v11.0.0+
Xbase++
Change a Filename before Unzipping
See more Zip Examples
How to open a zip and modify the filename of one or more files within the zip before unzipping.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oZip
LOCAL oEntry
LOCAL nNumFilesUnzipped
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oZip := CreateObject("Chilkat.Zip")
nSuccess := oZip:OpenZip("test.zip")
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
RETURN
ENDIF
oEntry := CreateObject("Chilkat.ZipEntry")
nSuccess := oZip:EntryOf("hamlet.xml", oEntry)
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
oEntry:destroy()
RETURN
ENDIF
oEntry:FileName := "hamlet2.xml"
nSuccess := oZip:EntryOf("helloWorld.pl", oEntry)
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
oEntry:destroy()
RETURN
ENDIF
oEntry:FileName := "hw.pl"
// Now unzip to the "test" subdirectory, under our current
// working directory:
nNumFilesUnzipped := oZip:Unzip("test")
IF (nNumFilesUnzipped < 0)
? oZip:LastErrorText
oZip:destroy()
oEntry:destroy()
RETURN
ENDIF
// The filenames within the .zip are unchanged, but it unzipped
// test/hw.pl and test/hamlet2.xml
oZip:destroy()
oEntry:destroy()