1. -- ************************************************************************
  2. -- Script:   ZIPLIST
  3. -- Version:  0.2 - D11.5 version based on bytearray
  4. -- Date:     2009-04-06
  5. --
  6. -- purpose:
  7. -- returns list of files found in ZIP archive
  8. --
  9. -- requirements:
  10. -- fileIO xtra and FILE_FILEIO interface script
  11. --
  12. -- usage:
  13. -- put ziplist("c:\test.zip")
  14. -- ************************************************************************
  15. on ziplist fn
  16.   fp = fopen(fn, "rb")
  17.   if fp=0 then return
  18.   fsize = fsize(fp)
  19.   fseek (fp, fsize-6)  
  20.   pos = freadint32(fp)
  21.   fseek (fp, pos)  
  22.   filelist = []
  23.   repeat while true
  24.     if freadint32(fp)<>33639248 then exit repeat -- P K 01 02 = 33639248
  25.     fseek(fp, 24, 1)    
  26.     len = freadint16(fp)
  27.     fseek(fp, 16, 1)
  28.     filelist.add(fread(fp, len))
  29.   end repeat
  30.   fclose(fp)
  31.   return filelist
  32. end
  33.  
[raw code]