ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Use conditions
  • Error codes
  • Archive destination
  • Source archive deletion
  • Reserved space
  • Splitting order
  • Number of parts
  • Closing the archive
  • Actions that can be performed on a multi-part archive
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
Splits an archive into several sub-archives of a given size.
iPhone/iPad This function is now available for iPhone/iPad applications.
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax
ResOpenArchive, ResSplit are int
Archive is zipArchive
 
// Open the archive named "Archive"
ResOpenArchive = zipOpen(Archive, "D:\Backups\Backup.WDZ")
 
IF ResOpenArchive = 0 THEN
// Split an archive into several sub-archives (1.4 MB each)
ResSplit = zipSplit(Archive, "A:\Archive.WDZ", 1400*1024)
...
END
Syntax
<Result> = zipSplit(<Archive> , <Archive destination> [, <Size of sub-archives> [, <Source archive deletion> [, <Reserved space> [, <Progress bar management>]]]])
<Result>: Integer
  • 0 if the archive was split,
  • 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 destination>: Character string
Full path of new multi-part archive (up to 260 characters). This path must contain the name of the multi-part archive to create. You have the ability to specify the same path and name as the source archive: the source archive will be overwritten by the split archive.
<Size of sub-archives>: Optional integer
Size (in bytes) of the volumes to create. The default size of sub-archive is equal to 1.4 MB (1400*1024 bytes). The minimum size is equal to 300KB for each sub-archive (300*1024 bytes).
<Source archive deletion>: Optional boolean
  • True if the source archive will be deleted during the split,
  • False (default value) if the source archive will not be deleted during the split.
<Reserved space>: Optional integer
Size (in bytes) of a reserved space to deduct from the size of first sub-archive. The size of first sub-archive will be: <Size of sub-archives> - <Reserved space>.
<Progress bar management>: Optional character string
WINDEVAndroidiPhone/iPadMac Catalyst Name of the Progress Bar control in a window. The progress bar will display the progress of split.
Remarks

Use conditions

An archive can be split if:
  • The archive exists (archives are created using zipCreate).
  • The archive is accessible in read/write.
  • The archive is a single-part archive.
Caution:
  • Archives in "CAB" format: This function is not available.
  • Archives in "RAR" format: This function is not available.
  • Archives in "7z" format: This function is not available.
  • Archives in "TAR" and "TARGZ" format: This function is not available.
LinuxiPhone/iPadIOS WidgetMac Catalyst Reminder: Only ZIP, TAR and TGZ (TAR.GZ) archives are available.

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.
  • 6: The sub-archives are not arranged in order.
  • 22: Unable to split as archive in zip format into a single part.
The message corresponding to the error code is returned by zipMsgError.

Archive destination

<Destination> must correspond to a media accessible in read/write. This parameter can be:
  • A hard disk.
  • A network drive to which a drive letter was assigned. No split operation can be performed to a UNC drive.
Extension of the multi-part archive (WDZ format)Extension of the multi-part archive (ZIP format)
If the extension of the archive is not specified, the default extension of first sub-archive will be .WDZ.
The extension of other sub-archives will be automatically added (".001" to ".999").
For example: If <Destination> = "C:\MyArchives\SplitArchive.WDZ", the archive will be split into the "C:\MyArchives" directory as follows:
  • SplitArchive.WDZ
  • SplitArchive.001
  • SplitArchive.002
  • SplitArchive.003
  • ...
If the archive extension is not specified, the default extension of first sub-archive will be .ZIP.
The extension of other sub-archives will be automatically added (".Z01" to ".Z99").
For example: If <Destination> = "C:\MyArchives\SplitArchive.ZIP", the archive will be split into the "C:\MyArchives" directory as follows:
  • SplitArchive.ZIP
  • SplitArchive.Z01
  • SplitArchive.Z02
  • SplitArchive.Z03
  • ...

Source archive deletion

If <Source archive deletion> is set to True, the source archive is closed and destroyed as the split is performed.
Remarks:
  • To reduce the disk space required to perform the split operation, <Source archive deletion> must be set to True. Indeed, to split a large archive, the necessary disk space is twice the archive size: once for the source archive and once for the split archive.
  • This parameter must be used with great care. Indeed, if a problem occurs during the split operation, the source archive and the split archive will both be destroyed. If the disk space is not sufficient, we advise you to split the source archive and to delete this source archive thereafter.

Reserved space

The size of first sub-archive can be smaller than the size of other sub-archives. To do so, specify how much you want to reduce the size of first sub-archive (in bytes) in <Reserved space>.
The size of first sub-archive will be: <Size of sub-archives> - <Reserved space>.
Remark: The size of the first sub-archive must comply with the following formula:
<Size of sub-archives> - <Reserved space> > 300 KB

Splitting order

When splitting an archive, the order in which the archive is split is as follows:
  • Creating the sub-archive N (".NNN-1" or ".ZNN-1" extension).
  • ...
  • Creating the sub-archive 2 (".001" or "Z01" extension).
  • Creating the sub-archive 1 (".WDZ" or "ZIP" extension).
For example, if an archive is split into 4 parts, 4 sub-archives will be created. The fourth sub-archive (".003" or "Z03" extension) will be created first. The first sub-archive (".WDZ" or ".ZIP" extension) will be created last.

Number of parts

zipNbPartNeeded is used to determine the number of parts required to split the archive.
zipNbPart is used to determine the number of sub-archives in a multi-part archive.
Remark: Splitting an archive in ZIP format into a single part is not allowed and it triggers an error.

Closing the archive

Once zipSplit has been used on an archive, this archive is not closed. You must use:
  • zipClose to close the single-part archive.
  • zipOpen to open the new multi-part archive.
Remark: If <Source archive deletion> is set to True, the source archive is automatically closed by the split operation.

Actions that can be performed on a multi-part archive

Some archiving functions can only be used on the single-part archives (add and delete files, create a self-extracting executable, etc.). To perform these operations, simply merge the sub-archives (zipMerge) to get a single-part archive.
From a multi-part archive, you can only:
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: 03/17/2023

Send a report | Local help