CopyToZip()
|
Previous Top Next |
:CopyToZip(<cEntry> | <nEntry> | <oEntry>,
|
<oXbZLibZip>) --> lSuccess
|
The first Parameter can be either a Character String, a Number, or a Central Directory Record Object:
|
|
<cEntry>
|
<cEntry> specifies the File Name of the Central Directory Record Entry that contains the information for the (File) Entry that should be copied to the other Zip File.
|
<nEntry>
|
<nEntry> specifies the Index Number of the Central Directory Record Entry that contains the information for the (File) Entry that should be copied to the other Zip File.
|
<oEntry>
|
<oEntry> specifies the ZipCentralDirectoryRecord object of the (File) Entry that should be copied to the other Zip File.
|
<oXbZLibZip>
|
<oXbZLibZip> specifies a second XbZLibZip object that represents a Zip File that is open and can be written to, and to which the selected (File) Entry should be copied.
|
This method returns .T. (TRUE) if the (File) Entry could be copied, or .F. (FALSE) if it could not.
|
Copies the specified (File) Entry to a second XbZLibZip object that must be open in XBZ_OPEN_CREATE or XBZ_OPEN_UPDATE Mode. If a (File) Entry with the same File Name already exists in the other Zip File, it will be replaced, otherwise it will be added. If the other Zip File is not open in the correct Open Mode or the (File) Entry could not be successfully copied to the other Zip File for any other reason, the method will return .F. (FALSE), otherwise .T. (TRUE) is returned.
|
Create and open a new Zip File named "NewArchive.zip" and open an existing Zip File named "OldArchive.zip" in Read-Only mode. Then copy the File Entry "File2Copy.xxx" from the "OldArchive.zip" to the "NewArchive.zip", save the changes, and close both Zip Files. This is basically a cleaner/simpler version of the :CopyFromZip() and :AddEntry() examples:
|
oNewZip := XbZLibZip():New('NewArchive.zip', XBZ_OPEN_CREATE)
|
oOldZip := XbZLibZip():New('OldArchive.zip', XBZ_OPEN_READ)
|
oOldZip:CopyToZip('File2Copy.xxx', oNewZip)
|
oOldZip:Close()
|
oNewZip:Close()
|