- 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
<zipArchive variable>.Split (Function)
In french: <Variable zipArchive>.Découpe
Splits an archive into several sub-archives of a given size.
ResOpenArchive, ResSplit are int
Archive is zipArchive
// Open the archive named "Archive"
ResOpenArchive = Archive.Open("D:\Backups\Backup.WDZ")
IF ResOpenArchive = 0 THEN
// Split an archive into several sub-archives (1.4 MB each)
ResSplit = Archive.Split("A:\Archive.WDZ", 1400*1024)
<Result> = <Archive>.Crop(<Archive destination> [, <Size of sub-archives> [, <Source archive deletion> [, <Reserved space> [, <Progress bar management>]]]])
- 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>: zipArchive variable
Name of a variable of type zipArchive corresponding to the archive to use.
<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
An archive can be split if:
- The archive exists (archives are created using <zipArchive variable>.Create).
- The archive is accessible in read/write.
- The archive is a single-part archive.
- 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.
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
<Destination> must correspond to a media accessible in read/write. This parameter can be:
- A hard disk.
- A floppy drive, a network drive, etc.
- A network drive to which a drive letter was assigned. No split operation can be performed to a UNC drive.
The destination is a floppy disk: a dialog box automatically asks for the change of diskettes. If the "Cancel" button of this dialog box is used, <zipArchive variable>.Split returns error #3: "The split archive is corrupted (its creation is not completed), the source archive is intact".
Caution: If <Source archive deletion> is set to True, the source archive and the split archive are both corrupted.
|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:
|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:
Source archive deletion
If <Source archive deletion> is set to True, the source archive is closed and destroyed as the split is performed.
- 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.
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>.
For example, when copying to diskettes, it may be useful if the first sub-archive does not occupy the entire space on the first diskette. This allows you to store the existing files on the first diskette.
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.
For example, if the size of each sub-archive is 1.4 MB, the size of the reserved space cannot exceed 1.1 MB.
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.
Splitting an archive on diskettes directly: The first inserted diskette will contain the last sub-archive.
Number of parts
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 <zipArchive variable>.Split has been used on an archive, this archive is not closed. You must use:
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 (<zipArchive variable>.Merge
) to get a single-part archive.
From a multi-part archive, you can only:
This page is also available for…
Click [Add] to post a comment