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.

ItemExtract Loop from a Zip or Unzip Return Value

Keywords: 	  ItemExtract

Question:

The new zip extender works real well, even though the functions return an extra tab, so on item counts you have to do an itemcount -1

Is this intentional? code below takes the list and adds them to entries in an ini file.

Everyone should note that the @LF's are now @tabs

	ziplist = zZipFiles("", tmpzip,"\archive\*.ctl","")
	filecount = itemcount(ziplist, @TAB)
	for i = 1 to filecount -1 ;take into account extra tab
		file = itemextract(i+1,ziplist,@TAB)
		IniWritePvt("Files", "CTL %i%",file , "%path%\6920bak.INI")
		IniWritePvt("","","","%path%\6920bak.INI")
	next

Answer:

zZipFiles and zUnZipFiles return an error value for the first item in the list, so here is the revised script.
	ziplist = zZipFiles("", tmpzip,"\archive\*.ctl","")
	filecount = itemcount(ziplist, @TAB)
	for i = 2 to filecount ;take into account extra tab
		file = itemextract(i+1,ziplist,@TAB)
		IniWritePvt("Files", "CTL %i%",file , "%path%\6920bak.INI")
		IniWritePvt("","","","%path%\6920bak.INI")
	next

Article ID:   W12694
Filename:   ItemExtract from a Zip or Unzip Return Value.txt
File Created: 2017:07:28:12:58:55
Last Updated: 1999:04:15:15:49:00