AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos
  • Calculating the size of the files to extract from an archive
Calculating the size of the files to extract from an archive
WINDEVWEBDEV - Código ServidorWindowsCódigo de Usuario (UMC)Ajax The following code is used to check whether there is enough disk space to extract all the files from an archive. To do so, the uncompressed size of all the files found in an archive is compared to the available disk space (fDriveInfo).
// Declare and initialize the variables
ArchiveName is string = "MyArchive"
ErrorCodeOpen is int
ErrorCodeExtract is int
DiskSize is real
 
// Open an archive
ErrorCodeOpen = zipOpen(ArchiveName, "C:\Directory\Archives\ArchivePdf.wdz")
 
IF ErrorCodeOpen = 0 THEN
// Extract the files from the archive
IF YesNo("Do you want to extract all the files from the archive?") THEN
// Calculate the available space
DiskSize = fDriveInfo("C:\Temp", fdFreeSpace)
// Is there enough disk space?
IF DiskSize > zipSize(ArchiveName) THEN
// Extract all the files from the archive
ErrorCodeExtract = zipExtractAll(ArchiveName, zipDirectory)
// Error message if the files have not been extracted
IF ErrorCodeExtract <> 0 THEN
Error(zipMsgError(ErrorCodeExtract))
END
ELSE
// Insufficient disk space
Info("Insufficient space to extract the files")
END
END
ELSE
// Display an error message if the archive was not opened
Error(zipMsgError(ErrorCodeOpen))
END
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local