wwZipArchive::GetZipEntries

Get a list of entries for the files contained inside of the zip file as a FoxPro Collection. Use this method to manually check the content of a zip file or selectively extract files.

The structure of the zip entries is:

  • Name - Just the filename
  • FullName - Full name including file relative path (if any)
  • Length - Original file size
  • CompressedLength - Compressive file size
o.GetZipEntries(lcZipFile)

Parameters

lcZipFile

Example

*** Look at all files in the zip   
loEntries = loZip.GetZipEntries(lcZipFile)
IF ISNULL(loEntries)
   ? "No entries:  " + loZip.cErrorMsg
   RETURN 
ENDIF
? loEntries.Count

*** Iterate through the collection
FOR EACH loEntry IN loEntries FoxObject     
	? loEntry.Name + "  " + ;
	  loEntry.Fullname + " " + ;
	  TRANSFORM(loEntry.Length) + " - " + ;
	  TRANSFORM(loEntry.CompressedLength)

      *** Selective extract files
 	  IF ATC(".prg",loEntry.Name)        
		loZip.UnzipFile(lcZipFile, loEntry.FullName, "d:\temp\" + loEntry.Name)  
	ENDIF
ENDFOR

See also:

Class wwZipArchive | wwZipArchive::UnzipFile | wwZipArchive::ZipFiles | wwZipArchive::UnzipFolder

© West Wind Technologies, 1996-2024 • Updated: 06/01/24
Comment or report problem with topic