ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Splitting an archive
zipSplit (Example)
Splitting an archive
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax
The following code is used to split an archive. Each sub-archive will be copied onto a diskette. The size of the sub-archives will be equal to 1.4 MB. The source archive is not deleted during the split operation. A 100 KB space is reserved on the first diskette.
// Declare and initialize the variables
CreationErrorCode is int
AdditionErrorCode is int
ErrorCodeSplit is int
NbNecessaryParts is int
 
// Create an archive
ErrorCodeCreate = zipCreate("MyArchive", "C:\MyArchives\MyArchive.zip")
 
IF CreationErrorCode = 0 THEN
// Add files into this archive
AdditionErrorCode = zipAddDirectory("MyArchive", ...
"C:\MyDir\MyFiles", True, zipDirectory)
IF AdditionErrorCode = 0 THEN
// Number of necessary diskettes
NbNecessaryParts = zipNbPartNeeded("MyArchive", ...
1400*1024)
  Info(NbNecessaryParts + "diskettes are required")
// Split the archive
ErrorCodeSplit = zipSplit("MyArchive", ...
"A:\Archive.WDZ", 1400*1024, False, 100*1024)
// Display the error message
// if the archive was not split
IF ErrorCodeSplit <> 0 THEN
 Error(zipMsgError(ErrorCodeSplit))
END
ELSE
// Display the error message
// if the files have not been added
Error(zipMsgError(AdditionErrorCode))
  END
ELSE
 // Display an error message if the archive was not created
 Error(zipMsgError(CreationErrorCode))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help