ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Archive functions
  • Returning the list of files found in an archive
zipListFile (Example)
Returning the list of files found in an archive
The following code is used to display the list of archive files in a Table control populated programmatically (TABLE_FileArchive).
// Declare and initialize the variables
ArchiveName is string = "MyArchive"
DirectoryName is string
AListOfFiles is string
CreationErrorCode is int
AdditionErrorCode is int
 
// Create an archive
CreationErrorCode = zipCreate(ArchiveName, "C:\Directory\Archives\ArchivePdf.zip")
 
// Create an archive (WINDEV Mobile)
// CreationErrorCode = zipCreate(ArchiveName, "\Directory\Archives\PdfArchive.wdz")
 
IF CreationErrorCode = 0 THEN
// Select the directory
DirectoryName = fSelectDir("", "", "Directory to add")
// Add all the files found in the selected directory
// and subdirectories to the archive
AdditionErrorCode = zipAddDirectory(ArchiveName, DirectoryName, True, zipDirectory)
IF AdditionErrorCode = 0 THEN
// Return the list of files found in the archive
AListOfFiles = zipListFile(ArchiveName)
// Display the list of files in a Table control populated programmatically
  TableAdd(TABLE_FileArchive, AListOfFiles)
ELSE
// Display an error message if the files have not been added
  Error(zipMsgError(AdditionErrorCode))
END
ELSE
// Display an error message if the archive was not created
Error(zipMsgError(CreationErrorCode))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help