Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Identify if ZIP File is Corrupted
Message
De
25/04/2013 12:27:03
 
 
À
24/04/2013 16:37:30
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01571775
Message ID:
01571883
Vues:
38
>>>>>>Hi,
>>>>>>
>>>>>>How can I to identify if ZIP file is corrupted, through VFP?
>>>>>>Thanks in Advance!
>>>>>
>>>>>
>>>>>I have done this a few ways. The most straight-forward is to use a utility like 7za.exe (a stand-alone version of 7-zip) to test the archive and parse the output looking for its error message.
>>>>
>>>>Rick,
>>>>
>>>>Thanks!
>>>>Is there some trick to do this with PKZ.exe utility?
>>>
>>>
>>>No trick. But PKUNZIP won't work on 64-bit computers. To get the archive utility's output, just pipe the result using (the greater than sign) to a file which you can parse afterward:
>>>
>>>
! PKUNZIP -t myfile.zip > output.txt
>>>! 7za t myfile.zip > output.txt
>>>
>>>Then use:
>>>
lcResult = FILETOSTR("output.txt")
>>>afterward, and look for the error notification. You can find an error by creating a false archive and testing it.
>>
>>There is a command-line version of PKZIP for Windows available -- PKZIPC.EXE, which *will* run on 64-bit Windows environment. Command-line parameters are a little different however (e.g. "-test" rather than "-T")
>
>Naoto,
>
>I used a "PKZ.exe" (2010) and it show me "-test" rather than "-T" in your help, but when I put "the greater than" sign to get the output file the command line simply stop and I needed type [Control] + [C] to break. I think it is because of the old "PKZ.exe".

You may want to go to the command line and enter the command (without the output redirection) to see what is going on -- the format of the command might not be correct, and PKZ.EXE may be waiting for input (but since you're redirecting the output you can't see this).

If I recall correctly for the DOS PKUNZIP program the syntax for testing a ZIP file would be:
pkunzip -t zipfile

For PKZIPC the corresponding command would be
pkzipc -test zipfile

One note about the redirected output -- it may contain backspaces as a result of the "running" percentage display. For example, let's say when you use the command line ZIP utility you see a percentage display -- let's say for example you see 10%, 20%, 30%... If you redirect the output to a text file and open the resulting file in a text editor, you'll see something like:

Testing: FILE1 10%[bksp][bksp][bksp]20%[bksp][bksp][bksp]30%[bksp][bksp][bksp]40%[bksp][bksp][bksp] ...

where "[bksp]" is the ASCII backspace character.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform