ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Example 1: Extracting all the files from the archive
  • Example 2: Extracting all the files from the archive while displaying a progress bar
zipExtractAll (Example)
Example 1: Extracting all the files from the archive
WEBDEV - Server codeAjax The following code is used to extract all the files from an archive and to decompress them. The stored path of the files contains: the name of the directories, the name and extension of the file. The extracted files are copied onto diskettes ("A:\Archive").
// Declare and initialize the variables
DirectoryName is string
ArchiveName is string = "MyArchive"
CreationErrorCode is int
AdditionErrorCode is int
ErrorCodeExtract is int
 
// Create an archive
CreationErrorCode = zipCreate(ArchiveName, "C:\Directory\Archives\ArchivePdf.wdz")
IF CreationErrorCode = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and subdirectories to the archive
AdditionErrorCode = zipAddDirectory(ArchiveName, DirectoryName, True, zipDirectory)
IF AdditionErrorCode = 0 THEN
  // Extract and decompress the files
    // The files are copied onto diskettes
  ErrorCodeExtract = zipExtractAll(ArchiveName, "A:\Archive")
  // Display an error message if the files were not extracted
IF ErrorCodeExtract <> 0 THEN
Error(zipMsgError(ErrorCodeExtract))
END
ELSE
    // Display an 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
Example 2: Extracting all the files from the archive while displaying a progress bar
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