PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV, WEBDEV and WINDEV Mobile 26 feature!
  • Error codes
  • Filter
  • Extracted file
  • Extraction and password
  • Stored path
  • Extraction from a multi-part archive on diskettes
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Automatically extracts and decompresses files from a directory in the file tree of an archive to a physical location.
Example
Archive is zipArchive
// Open an archive
IF Archive.Open("C:\Archives\Archive.zip") = 0 THEN
// Extract the "Temp" directory at the root of the archive file tree
Archive.ExtractDirectory("Temp", zipDrive)
END
Syntax
<Result> = <Archive>.ExtractDirectory(<Directory> [, <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>: Control to use
Name of archive to use.
This name can correspond to:
<Directory>: Character string (with quotes)
Archive file directory to be extracted. This directory can be an absolute path or a path relative to the root of the archive file tree.
<Destination>: Optional character string
Destination path of extracted files:
  • Optional character string: The files are extracted into the specified path to which is added the tree structure of the file (the disk is not stored). The specified path is created if it does not exist.
    Universal Windows 10 App The destination path of the extracted file must correspond to the working directory of the application (returned by fDataDir) or to one of its subdirectories.
  • Optional constant:
    zipNoneExtraction 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/iPad This constant is not available. The directories have no root.
    AndroidAndroid Widget This constant and zipDirectory will have the same effect. Archives in 7z format: This constant and zipDirectory will have the same effect.
    zipDirectory
    (Default value)
    Extraction into the current directory without restoring the tree structure of the files (if it was stored).
Windows Mobile These constants cannot be used because the notion of current directory is not supported by the Pocket PC.
Universal Windows 10 App These constants cannot be used.
<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 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.
For more details on this procedure, see Parameters of the error handling procedure used by <zipArchive variable>.ExtractDirectory.
WEBDEV - Server code This procedure must be a server procedure.
<Progress>: Control name or procedure name
Versions 21 and later
Progress bar management mode. This parameter can correspond to:
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.
WEBDEV - Server code The procedure must be a server procedure.
New in version 21
Progress bar management mode. This parameter can correspond to:
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.
WEBDEV - Server code The procedure must be a server procedure.
Progress bar management mode. This parameter can correspond to:
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.
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).
  • 21: The specified password is not correct.
The message corresponding to the error code is returned by zipMsgError.
Remarks:
  • LinuxiPhone/iPadUniversal Windows 10 App Only ZIP, TAR and TGZ (TAR.GZ) archives are available.
  • Windows Mobile Only ZIP archives are available.
  • AndroidAndroid Widget The CAB format is not available.

Filter

If a filter has been set on the archive with <zipArchive>.SelectFile, only the files that match the filter will be extracted.

Extracted file

The extracted files are not deleted from the archive. To delete one file or all the files from the archive, use <zipArchive variable>.DeleteFile or <zipArchive variable>.DeleteAll.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadUniversal Windows 10 AppWindows MobileAjaxUser code (UMC)

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 occurs.

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 zipDrive constant 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 The zipDrive constant is equivalent to the zipDirectory constant.
Universal Windows 10 App The directory and the disk are not stored in the archive path. Only the file name and extension are stored.
Windows Mobile The table below presents the paths stored in the archive according to:
  • the access path to the file,
  • the stored path section.
zipAddFileFile locationzipNonezipDirectory
zipAddFile("Archi",
"\File.txt")
\File.txtFile.txtFile.txt
zipAddFile("Archi",
"\Temp\File.txt")
\Temp\File.txtFile.txtTemp\File.txt
WINDEVWEBDEV - Server codeReports and QueriesAjaxUser code (UMC)

Extraction from a multi-part archive on diskettes

If the files to extract are found on different diskettes, the corresponding diskette is automatically requested.
Component : wd260zip.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment