ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Error codes
  • Extracted file
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Extracts all files from an archive and decompresses them.
The archive used can be in CAB, RAR, ZIP, WDZ, 7z, TAR or TGZ (TAR.GZ) format.
WEBDEV - Server codeAjax
Archive is zipArchive
 
// Open an archive
ResOpenArchive = zipOpen(Archive, "C:\Archives\Archive.zip")
 
IF ResOpenArchive = 0 THEN
...
// Extract all files from the archive
ResExtractAll = zipExtractAll(Archive, zipDrive)
...
END
Syntax
<Result> = zipExtractAll(<Archive> [, <Destination of files> [, <Options>] [, <WLanguage procedure>] , [ <Progress bar management>]])
<Result>: Integer
  • 0 if the files have been extracted,
  • An error code (value greater than 0) otherwise. For more details on these error codes, see the Remarks.
<Archive>: Character string or zipArchive variable
Name of the archive to be used.
This name can correspond to:
<Destination of files>: Optional character string or constant
Destination path of extracted files:
  • Optional character string: The files are extracted into the specified path to which is added the tree structure of each file (the disk is not stored). The specified path is created if it does not exist.
  • Optional constant:
    zipDirectoryExtraction into the current directory while restoring the tree structure of file (if it was stored).
    zipDriveExtraction:
    • to the initial file location if it was stored and if the drive exists.
    • while restoring the tree structure of the file on the current drive if the drive or the stored directory does not exist.
    • into the current directory if only the file name and extension have been stored.
    Remark: If the zipDrive constant is used, the WDZ format stores the full path of the file (including the drive letter) while the ZIP format does not store the drive letter.

    Linux This constant is not available. The directories have no root.



    Archives in 7z format: This constant and zipDirectory will have the same effect.
    zipOverwriteDuring the extraction, the existing read-only files are automatically overwritten by the extracted files. This constant can be combined with the zipDrive and zipDirectory constants.

<Options>: Optional constant
Configure the extraction (if <Destination of files> corresponds to a character string):
zipOverwriteDuring the extraction, the existing read-only files are automatically overwritten by the extracted files.
<WLanguage procedure>: Optional procedure name
Name of the WLanguage procedure that will be called if an error occurs when extracting files.
CAUTION: This parameter can be used only if <Archive> corresponds to a zipArchive variable.
This procedure has the following format:
PROCEDURE <Procedure name>(<Error code>, <File name>)
where:
  • <Error code> is an integer corresponding to the code of the error that occurred when extracting the file.
  • <File name> is a character string that contains the path of the file processed by zipExtractAll.
The procedure can return one of the following constants:
zipCancelCancels the extraction of files from the archive.
zipIgnoreIgnores the file in error.
zipRetryRetries the file extraction.

WEBDEV - Server code This procedure must be a server procedure.
<Progress>: Control name or procedure name
Progress bar management mode. This parameter can correspond to:
  • the name of a WLanguage procedure. This procedure has the following format:
    PROCEDURE <Procedure name> (<Current file>,
    <Global progress percentage>, <File progress percentage>)

    where:
    • <Current file> corresponds to the name of the file currently processed.
    • <Global progress percentage> corresponds to the progress percentage of the extraction of files from the archive.
    • <File progress percentage> corresponds to the progress percentage of the file being extracted from the archive.
If you are using an archive:
  • in TAR or TGZ (TAR.GZ) format, the progress bar is refreshed at the end of the extraction of each file.
  • in CAB and RAR format, the progress bar is refreshed at the end of the extraction of each file.
  • in 7z format, only <Overall progress percentage> is specified. <File progress percentage> will have the same value.
WEBDEV - Server code The procedure must be a server procedure.
Remarks

Error codes

The following error codes are returned:
  • 1: The path passed as parameter does not exist.
  • 2: Access denied: the user has no sufficient rights.
  • 3: The archive is corrupted.
  • 4: The path does not exist in the archive.
  • 6: The files of the sub-archives are not arranged in order (when extracting from a multi-part archive).
The message corresponding to the error code is returned by zipMsgError.
Reminder:
  • Linux Only ZIP, TAR and TGZ (TAR.GZ) archives are available.
  • RAR is supported up to and including version 4.

Extracted file

The extracted files are not deleted from the archive. To delete one file or all the files from the archive, use zipDeleteFile or zipDeleteAll.
Business / UI classification: Business Logic
Component: wd290zip.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/12/2023

Send a report | Local help