AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos
  • Error codes
  • Extracted file
  • Extraction and password
  • Stored path
  • Extraction from a multi-part archive on diskettes
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Extracts and decompresses a list of files found in an archive to a physical location.
New in version 2025
WINDEVWEBDEV - Server codeWindowsLinuxiPhone/iPad The gzip format (.gz extension) is now supported.
Example
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax
Archive is zipArchive
// Ouverture d'une archive
ResOuvreArchive = zipOpen(Archive, "C:\Archives\Archive.zip")
IF ResOuvreArchive = 0 THEN
	...
	 // Extraction d'un fichier à son emplacement d'origine
	 ResExtraitFichier = zipExtractFileList(Archive, "\Temp\Fichier.doc" + ...
		CR + "\Temp\Fichier2.doc", zipDrive)
	...
END
Syntax
<Result> = zipExtractFileList(<Archive> , <List of paths> [, <Destination> [, <Options> [, <WLanguage procedure> [, <Progress>]]]])
<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:
<List of paths>: Character string
List of stored paths of files that will be extracted from the archive. The different paths are separated by CR characters (Carriage Return).
Performs an exact-match search on each path of files found in the archive.
<Destination>: Optional character string or constant
Destination path of extracted files:
  • Optional character string: Files are extracted to the specified path, to which the file's memorized tree structure is added (the disk is not preserved). The specified path is created if it does not exist.
  • Optional constant:
    zipDirectory
    (Default value)
    Extraction into the current directory without restoring the tree structure of the files (if it was stored).
    zipDriveExtraction:
    • to the initial location of the files if it was stored and if the drive exists.
    • while restoring the tree structure of the files on the current drive if the drive or the stored directory does not exist.
    • in the current directory if only the name and extension of the files have been stored.
    LinuxiPhone/iPadIOS WidgetMac Catalyst This constant is not available. The directories have no root.
    AndroidAndroid Widget Java This constant and zipDirectory will have the same effect.
    Archives in format 7z: This constant will have the same effect as the constant zipDirectory.
    zipNoneExtraction into the current directory without restoring the tree structure of the files (if it was stored).
<Options>: Optional Integer constant
Configure the extraction (if <Destinations> corresponds to a character string):
zipOverwriteDuring the extraction, the existing read-only files are automatically overwritten by the extracted files.
AndroidAndroid Widget Java This constant is not available.
<WLanguage procedure>: Optional procedure name
Name of the WLanguage procedure that will be called if an error occurs when extracting files. This procedure has the following format:
PROCEDURE ProcedureName (<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 zipExtractFileList.
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.
AndroidAndroid Widget Java This parameter is not allowed.
<Progress>: Control name or procedure name
Progress bar management mode. This parameter can correspond to:
  • WINDEViPhone/iPadMac Catalyst the name of a Progress Bar control found in a window. The progress bar will display the progress regarding the extraction of all the files used.
  • the name of a WLanguage procedure. This procedure has the following format:
    <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 handle an:
  • in TAR, gzip or TGZ (TAR.GZ) formatProgressBar is updated only when each file has been extracted.
  • 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: Path passed as parameter does not exist.
  • 2: Access denied: user does not have sufficient rights.
  • 3: The archive is corrupt.
  • 4: The path does not exist in the archive.
  • 6: Sub-archive files are not in order (case of extraction from a multi-part archive).
  • 21: The password specified is not correct.
The message corresponding to the error code is returned by zipMsgError.
Remarks:
  • LinuxiPhone/iPadIOS WidgetMac Catalyst Only archives in ZIP, TAR, gzip and TGZ (TAR.GZ) formats are available.
  • AndroidAndroid Widget Java Only ZIP archives are available.

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.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)Ajax

Extraction and password

If the file is not encrypted and if zipPassword was used:
  • Archive in WDZ format: The file is still extracted.
  • Archive in ZIP format: An error appears.

Stored path

The table below presents the paths stored in the archive according to:
  • the access path to the file,
  • the stored path section.
The current directory is: "C:\Temp".
zipAddFileFile locationzipNonezipDirectoryzipDrive
zipAddFile("Archi",
"File.txt")
C:\Temp\File.txtFile.txtFile.txtFile.txt
zipAddFile("Archi",
"Data\File.txt")
C:\Temp\Data\File.txtFile.txtData\File.txtData\File.txt
zipAddFile("Archi",
"D:\Data\File.txt")
D:\Data\File.txtFile.txtData\File.txtD:\Data\File.txt


Remark: If the constant zipDisk is used:
  • the WDZ format stores the full path of the file (including the drive letter).
  • the ZIP format does not store the drive letter.
  • the 7z format stores the directories only.
AndroidAndroid Widget Java The zipDrive constant is equivalent to the zipDirectory constant.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax

Extraction from a multi-part archive on diskettes

If the files to extract are found on different diskettes, the corresponding diskette is automatically requested.
Business / UI classification: Business Logic
Component: wd300zip.dll
Versión mínima requerida
  • Versión 14
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local