WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Zipper

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF to List Files in an Archive with "t" Option

Keywords: 	 UDF list files t option

Question:

list = zUnZipFiles('l', zipfile, '*.*', '', '')
The help file says that "l" returns a short format list of files in the archive - names, modification dates/times and comments - what I'm getting seems to be the verbose listing.

Anyway to get a shorter list that would be easier to parse?

Answer:

Try the "t" option to simply get a list of files FAST. zUnzipfiles() with "l" option seems to take about twice as long to return as "t" option.

I tried both methods on an archive with about 70 files and the "t" method seems to run about 10 - 15 times faster. Another advantage perhaps is using test you know that the archive is in good shape when you ask for a file from the list.

Here's a UDF that simplifies this even further:

#definefunction listzip(zipfile, action)
AddExtender("WWZIP32I.DLL")
list = zUnZipFiles('t', zipfile, '*.*', '', '')
if strsub(list, 1, 1) == 0
   if strsub(list, strlen(list), 1) == @tab then list = strsub(list, 1, strlen(list)-1)
   list = strreplace(list, 'OK%@tab%', @tab)
   cnts = itemcount(list, @tab)
   list = itemremove(cnts, list, @tab)
   list = itemremove(1, list, @tab)
   list = strreplace(list, @tab, '')
   list = strreplace(list, 'testing: ', ':')
   list = strreplace(list, '/', '\')
   list = strsub(list, strindex(list, ':', 1, @fwdscan)+1, -1)
   Ziplist = ''
   for cnt = 1 to itemcount(list, ':') 
      Ziplist = iteminsert(strtrim(itemextract(cnt, list, ':')), -1, Ziplist, @tab)
   next

   if strlower(action) == "select_files"
      asklist = ziplist
      Ziplist = askitemlist('Select Files to Extract', Asklist, @tab, @sorted, @multiple)
   endif
   if strlower(action) == "display_list" then askitemlist('Files in the archive', Ziplist, @tab, @sorted, @multiple)
else
   message("Error", "Impossibile to get a list of files in archive!")
   Ziplist = "Error"
endif
return Ziplist
;ziplist is the list of files OR "Error"
#EndFunction

Article ID:   W14815
File Created: 2001:11:08:12:40:08
Last Updated: 2001:11:08:12:40:08