• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 691
  • Last Modified:

how to test for bad zip using wzunzip called from shell command in VB6

I have written a small program in vb6 which calls wzunzip in shell command to unzip file to specific location.  Everything runs fine as long as the zip is in tact.  I am trying to take into consideration if the zip file is bad, how to determine that before my process continues.

Does anyone know how to retrieve and decipher the return code after the shell command calling WZUNZIP to determine if it is a bad zip or not.  I prefer to use wzunzip and not have to change the compression tool mid stream. It has a switch (-t) to test the zip but I don't know what value it returns to decipher the results.

Any help is appreciated.
0
edfreels
Asked:
edfreels
  • 2
  • 2
1 Solution
 
fullcontactCommented:
Could you save the results in a .txt file and analyse that?

ie

DIR >log.txt

This will store the results of the dir in the log.txt file
0
 
edfreelsAuthor Commented:
I have tried pulling the results into a variable and displaying it on the screen to decipher.  The problem is the results are different for each file it tests and unzips.  The result it is returning is an integer.  For example, the first file I test returns 176 and then the value returned when unzipping the file is 1688.  Then the next file that I run the same commands on returns 2 completely different numbers.  Here is how I am running the process to test the zip file for validity from the shell command:

ReturnValue = Shell(sBaseFolder & "wzunzip -t " & sUpldPath & strFile, vbMinimizedNoFocus)

The -t switch is telling it to test the zip.  I then run the following Shell command to unzip the file:

ReturnValue1 = Shell(sBaseFolder & "wzunzip -o " & sUpldPath & strFile & " " & sTempPath, vbMinimizedNoFocus)

Is there a different way to retrieve the status or results or a way to decipher what these numbers mean?  Am I going about it the wrong way?
0
 
fullcontactCommented:
I would try something like this

ReturnValue = Shell(sBaseFolder & "wzunzip -t " & sUpldPath & strFile & ">log.txt", vbMinimizedNoFocus)

then analyise the results stored in the log.txt file using VB to see if passed or failed

if you open log.txt in notepad you can see what text you need to look for, ie if passed or failed.
0
 
edfreelsAuthor Commented:
This is just what I needed.  I knew there had to be a way to get the results.  Thanks so much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now