ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Compression level
  • Error codes
  • Use condition
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Creates an archive. The created archive is automatically:
  • opened in read/write. If the archive is in CAB format, the created archive is opened in write-only.
  • a single-part archive.
The created archive can be:
  • in standard WinZip or PKZip format (.ZIP extension).
  • in "Cabinet files" format (.CAB extension).
  • in WINDEV format (.WDZ extension).
  • in 7z format (.7z extension).
  • in TAR format (.TAR extension).
  • in TGZ (TAR.GZ) format (.TGZ or .TAR.GZ extension).
  • New in version 2025
    in gzip format (.gz extension).
    No archive in "RAR" format can be created.
MonArchive is zipArchive
ResCréation is int
ResAjoutFichier is int
// Création de l'archive 
ResCréation = zipCreate(MonArchive, "C:\Temp\Archive.zip")
IF ResCréation = 0 THEN
	// Ajout d'un fichier dans une archive
	ResAjoutFichier = zipAddFile(MonArchive, ...
			"C:\MonRépertoire\MesFichiers\Fichier.pdf", zipDrive)
END
// Affichage du message d'erreur si le fichier n'a pas été ajouté
IF ResAjoutFichier <> 0 THEN 
	Error(zipMsgError(ResAjoutFichier))
END
Syntax
<Result> = zipCreate(<Archive> , <Archive path> [, <Options>])
<Result>: Integer
  • 0 if the creation was performed. In this case, the archive is opened. In order for this archive to be handled by the user before closing the application, don't forget to close the archive (zipClose).
  • 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:
<Archive path>: Character string
Path and name of archive (up to 260 characters). The archive extension must be specified:
  • ".WDZ" to create a WINDEV archive.
  • ".ZIP" to create an archive in WinZip or PKZip format.
  • ".CAB" to create an archive in "Cabinet Files" format.
  • ".7z" to create an archive in 7Z format.
  • ".TAR" to create an archive in TAR format.
  • ".TAR.GZ" to create an archive in TAR.GZ format.
  • ".TGZ" to create an archive in TGZ format.
  • New in version 2025
    ".gz" to create an archive in gzip format.
If no extension is specified, an archive in WDZ format is created.
Caution:
  • If the same archive already exists in the specified directory, this archive is overwritten by the new archive.
<Options>: Optional constant
Options for managing the archives:
zipAnsiUsed to force the backup of file names in Ansi format in the Archive file.
This constant is used by default in applications using the ANSI standard.
zipHeader64Allows you to:
  • create an archive larger than 4 gigabytes on which the zipChangePath function can be used.
  • increase the number of files in a ZIP archive. The default limit is 65535 files.. Using this constant, the limit increases to 4,294,967,295 files..
By default, this option is not used.
Archive in TAR, gzip or TGZ format (TAR.GZ): This constant is not available.
zipUncompressedThe contents of the archive will not be compressed.
Used with the CAB archives, this constant allows you to only use the function for archiving the CAB format.
By default, this option is not used.
Archive in TAR, gzip or TGZ format (TAR.GZ): This constant is not available.
zipUnicodeSaves Unicode file names in the Archive file.
This constant is used by default in an application using Unicode.
Archive in TAR, gzip or TGZ format (TAR.GZ) If this constant is used, file names in Unicode format are not saved in Unicode in the Archive file.

Archive format 7z: This parameter is not available.
Remarks

Compression level

The files added into a zip archive are compressed by default. You can change the compression level of files added to an archive using function zipCompressionLevel.

Error codes

The following error codes are returned:
  • 1: The path passed as parameter does not exist.
  • 2: Access denied: user does not have sufficient rights.
The message corresponding to the error code is returned by zipMsgError.

Use condition

Maximum number of files allowed:
  • in a WDZ file: 232-1.
  • in a ZIP file: 65535.
    This limit can be increased to 4,294,967,295 files using the constant zipEntête64.
  • in a CAB file: 65535.
Available formats:
    The size of a file included in an archive (regardless of its format) must be less than 4 GB.
    No archive in "RAR" format can be created.
    Business / UI classification: Business Logic
    Component: wd300zip.dll
    Minimum version required
    • Version 9
    This page is also available for…
    Comments
    Click [Add] to post a comment

    Last update: 05/28/2025

    Send a report | Local help