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.



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


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?


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)
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)

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

Article ID:   W14815
File Created: 2017:07:28:13:58:56
Last Updated: 2001:11:08:12:40:08