Scan Windows Server 2003 for Corrupt ZIP Files

JTG2003

New Member
A client I am doing work for recently had some NTFS errors on a file server. The result was a bunch of corrupt files which are currently only found when their software attempts to use them (and ends up crashing the software).

Most of the files are of a unique file type which I was able to search through and find corruption. However, there are a ton of ZIP files (Up to 159,000 of them). I have found a couple of them already when the software crashed. The more specific problem is some of the files (mostly text) within the zip are corrupt. The software attempts to add a new file to the ZIP and crashes trying to re-zip a corrupt file.

I currently have no way to find these files, and although I can fix them as the problems arise, the client won't like that very much. I would like to be proactive here.

Any ideas?

Thanks,
Jeremy
 
If you have a command-line zip validity checker, you could run it on every zip file in the filesystem. The one that comes to hand for me is the "unzip" that's included with cygwin. However, it may not check everything that your software needs in order to append to the file. But it's a start. Here's how I would do it in cygwin:
find /cygdrive/c -name '*.zip' -exec unzip -t {} \;
 
Just in case anyone else stumbled on this and needed an answer.....

I ended up using 7zip to accomplish this. I ran this at a command prompt (after adding 7z to the PATH variable)

FOR /R "C:\Test" %l IN (*.zip) DO 7z t "%l" >>C:\Test\Output.txt

This was created to be used in a folder hierarchy like the following
C:\Test\Group\Individual\File.zip

So it goes through every group.. and for every group, it goes through every individual.. and if there's a zip file, it runs a "test" on it with 7zip and outputs the results to a text file.

The results file was very large as it would also output results even if the file was OK but with a little purging of useless data, you can get a report of all corrupted zips.
 
Back
Top