Link to home
Start Free TrialLog in
Avatar of edfreels
edfreelsFlag for United States of America

asked on

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.
Avatar of fullcontact
fullcontact

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
Avatar of edfreels

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of fullcontact
fullcontact

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is just what I needed.  I knew there had to be a way to get the results.  Thanks so much!