PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of zipArchive variables
  • Functions that use the zipArchive variables:
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
The zipArchive type is used to handle an archive file corresponding to one of the following formats: ZIP, CAB, RAR, WDZ, 7z, TAR or TGZ (TAR.GZ). The characteristics of this file can be defined and modified by several WLanguage properties.
Note: See Declaring a variable for more details.
Versions 21 and later
This type of variable now supports the TAR and TGZ (TAR.GZ) formats.
New in version 21
This type of variable now supports the TAR and TGZ (TAR.GZ) formats.
This type of variable now supports the TAR and TGZ (TAR.GZ) formats.
Example
// Create a backup archive for the "My Documents" directory
MyArchive is zipArchive

// Protect the archive by a password
MyArchive..Password = "secret"

// Create the archive
zipCreate(MyArchive, "s:\Backups\" + DateToString(DateSys(), "YYYY-MM-DD") + ".zip")

// Add the files
zipAddDirectory(MyArchive, SysDir(srMyDocuments))

// Close the archive
zipClose(MyArchive)
Remarks

Properties specific to the description of zipArchive variables

The following properties can be used to handle a zipArchive variable:
NameType usedEffect
FileArray of zipArchivedFileArray of files found in the archive.
ArchiveFormatInteger constantFormat of the archive file:
  • zipFormatCAB: File in CAB format
  • zipFormatRAR: File in RAR format
  • zipFormatWDZ: File in WDZ format
  • zipFormatZIP: File in ZIP format
  • Versions 18 and later
    zipFormat7Z: File in 7z format
    New in version 18
    zipFormat7Z: File in 7z format
    zipFormat7Z: File in 7z format
  • Versions 21 and later
    zipFormatTAR: File in TAR format
    Windows Mobile Not available.
    New in version 21
    zipFormatTAR: File in TAR format
    Windows Mobile Not available.
    zipFormatTAR: File in TAR format
    Windows Mobile Not available.
  • Versions 21 and later
    zipFormatTARGZ: File in TGZ (TAR.GZ) format.
    Windows Mobile Not available.
    New in version 21
    zipFormatTARGZ: File in TGZ (TAR.GZ) format.
    Windows Mobile Not available.
    zipFormatTARGZ: File in TGZ (TAR.GZ) format.
    Windows Mobile Not available.
PasswordCharacter stringPassword that will be used to add files into the archive or to extract files from the archive.
See zipPassword for more details.
This property is available in write mode.
Versions 21 and later
7z format: No password can be used.
New in version 21
7z format: No password can be used.
7z format: No password can be used.
Versions 21 and later
TAR and TGZ (TAR.GZ) format: No password can be used.
New in version 21
TAR and TGZ (TAR.GZ) format: No password can be used.
TAR and TGZ (TAR.GZ) format: No password can be used.
NbFilesIntegerNumber of files found in the archive.
This property is available in read-only.
NbPartIntegerNumber of parts in a multi-volume archive.
For a single-volume archive, this property is equal to 1.
This property is available in read-only.
CompressionLevelIntegerCompression level that must be used to add files into the archive.
See zipCompressionLevel for more details.
Size8-byte integerTotal size of the files found in the archive (decompressed size).
This property is available in read-only.
CompressedSize8-byte integerTotal compressed size of the files found in the archive.
This property is available in read-only.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Functions that use the zipArchive variables:

Versions 09 and later
zipAddDirectory
New in version 09
zipAddDirectory
zipAddDirectory
Adds all the files found in a directory and in its sub-directories into an archive and compresses them.
Versions 09 and later
zipAddFile
New in version 09
zipAddFile
zipAddFile
Adds a file (of any type) into an archive in CAB, ZIP, WDZ and 7z, TAR or TGZ (TAR.GZ) format and compresses it.
Versions 09 and later
zipAddFileList
New in version 09
zipAddFileList
zipAddFileList
Adds a list of files (of any type) into an archive in ZIP, CAB, WDZ or 7z format and compresses it.
Versions 09 and later
zipChangePath
New in version 09
zipChangePath
zipChangePath
Modifies the stored path of a file in an archive (in ZIP, WDZ or 7z format).
Versions 09 and later
zipClose
New in version 09
zipClose
zipClose
Closes an archive.
Versions 11 and later
zipCompressionLevel
New in version 11
zipCompressionLevel
zipCompressionLevel
Changes the compression level used when creating an archive in ZIP format or in 7z format.
Versions 09 and later
zipCreate
New in version 09
zipCreate
zipCreate
Creates an archive.
Versions 09 and later
zipCreateExe
New in version 09
zipCreateExe
zipCreateExe
Creates a self-extracting archive in executable format (.EXE).
Versions 09 and later
zipCurrentFile
New in version 09
zipCurrentFile
zipCurrentFile
Returns the name of the archived file currently handled by the functions for adding and extracting files.
Versions 09 and later
zipDeleteAll
New in version 09
zipDeleteAll
zipDeleteAll
Deletes all files from an archive.
Versions 09 and later
zipDeleteFile
New in version 09
zipDeleteFile
zipDeleteFile
Deletes a file from an archive.
Versions 09 and later
zipDeleteFileList
New in version 09
zipDeleteFileList
zipDeleteFileList
Deletes a list of files from an archive.
Versions 12 and later
zipExist
New in version 12
zipExist
zipExist
Used to find out whether an archive exists.
Versions 09 and later
zipExtractAll
New in version 09
zipExtractAll
zipExtractAll
Extracts all files from an archive and decompresses them.
Versions 09 and later
zipExtractFile
New in version 09
zipExtractFile
zipExtractFile
Extracts a file from an archive and automatically decompresses it to a physical location or in memory.
Versions 12 and later
zipExtractFileList
New in version 12
zipExtractFileList
zipExtractFileList
Extracts and decompresses a list of files found in an archive to a physical location.
Versions 09 and later
zipExtractPath
New in version 09
zipExtractPath
zipExtractPath
Returns the path of a file found in the archive.
Versions 09 and later
zipFileSize
New in version 09
zipFileSize
zipFileSize
Returns the size of one of the files found in the archive (in CAB, RAR, WDZ, ZIP, 7z, TAR or TGZ format (TAR.GZ)):
  • the compressed size of the file.
  • the size of the file before compression.
Versions 09 and later
zipFindFile
New in version 09
zipFindFile
zipFindFile
Finds a file in an archive (in CAB, ZIP, RAR, WDZ or 7z format).
Versions 09 and later
zipInfoFile
New in version 09
zipInfoFile
zipInfoFile
Returns the characteristics of a file found an archive:
  • The name of the file and its stored path.
  • The initial size of the file.
  • The compressed size of file.
  • The date and time of file creation.
  • The date and time of file modification.
  • The date and time of file access.
  • The file attributes.
  • The encryption mode of the file.
Versions 09 and later
zipIsMulti
New in version 09
zipIsMulti
zipIsMulti
Returns the type of archive: single-part archive or multi-part archive.
Versions 09 and later
zipListFile
New in version 09
zipListFile
zipListFile
Returns the list of files found in an archive.
Versions 09 and later
zipMerge
New in version 09
zipMerge
zipMerge
Merges the different sub-archives found in a multi-part archive to create a single-part archive.
Versions 09 and later
zipNbFile
New in version 09
zipNbFile
zipNbFile
Returns the number of files found in an archive (in CAB, RAR, ZIP, WDZ or 7z format).
Versions 09 and later
zipNbPart
New in version 09
zipNbPart
zipNbPart
Returns the number of sub-archives (parts) found in an archive in CAB, RAR, ZIP, WDZ, 7z, TAR or TGZ format (TAR.GZ).
Versions 09 and later
zipNbPartNeeded
New in version 09
zipNbPartNeeded
zipNbPartNeeded
Returns the number of parts of a given size required to split a single-part archive.
Versions 09 and later
zipOpen
New in version 09
zipOpen
zipOpen
Opens an existing archive.
Versions 12 and later
zipOpenCAB
New in version 12
zipOpenCAB
zipOpenCAB
Opens an existing archive in CAB format.
Versions 12 and later
zipOpenRAR
New in version 12
zipOpenRAR
zipOpenRAR
Opens an existing archive in RAR format.
Versions 09 and later
zipPassword
New in version 09
zipPassword
zipPassword
Defines the password used to add files into the specified archive and to extract files from the specified archive (RAR, ZIP and WDZ format).
Versions 09 and later
zipSize
New in version 09
zipSize
zipSize
Returns the size of the archive (in ZIP, RAR, CAB, WDZ or 7z format):
  • the size of all the compressed files found in the archive.
  • the size of all the files found in the archive before compression.
Versions 09 and later
zipSplit
New in version 09
zipSplit
zipSplit
Splits an archive into several sub-archives of a given size.
Minimum required version
  • Version 15
This page is also available for…
Comments
Function: Buffer to Serialize Array String, after Zip file with crypt
PROCEDURE SerializaCompactaArquivo(Token, bufArquivoBinario)

//Serializar
bufArquivoBinario = Crypt(bufArquivoBinario,Token,cryptAnsi,encodeBASE64)

NomeArquivoTxt is string = "Buffer"+DateSys()+TimeSys() + ".txt"
NomeArquivoZip is string = "Buffer"+DateSys()+TimeSys() + "zip"

fDelete(NomeArquivoTxt)
fDelete(NomeArquivoZip)

fSaveBuffer(NomeArquivoTxt,bufArquivoBinario)

NumZipErr is int

NumZipErr = zipCreate("Pacote", NomeArquivoZip)

IF NumZipErr <> 0 THEN
Error(zipMsgError(NumZipErr))
END

NumZipErr = zipAddFile("Pacote", NomeArquivoTxt, zipNone)

IF NumZipErr <> 0 THEN
Error(zipMsgError(NumZipErr) + "On the file " + zipCurrentFile("Pacote"))
END

zipCompressionLevel("Pacote", 9)

ok is boolean

IF fFileExist(NomeArquivoZip) THEN
ok = True
bufArquivoBinario = fLoadBuffer(NomeArquivoZip)
bufArquivoBinario = Crypt(bufArquivoBinario,Token,cryptAnsi,encodeBASE64)
ELSE
ok = False
bufArquivoBinario = ""
END

RESULT(bufArquivoBinario)
BOLLER
Jun. 07 2017