0

I have all kinds of files that I have downloaded from everywhere over the years scattered around my hard drives. I’m in the process of trying to organize them all and have run into a problem. Sometimes a file was not downloaded correctly (this was a big issue when Chromium first came out) and is thus corrupt. For media files, this is may be simple to determine (it requires actually opening and examining the file). For executables or other binaries, it is relatively difficult (executables may or may not crash, other binaries could be completely unknown). Archive files (eg ZIP, RAR, 7Z, EXE, ACE, etc.) however should be pretty simple, they have a built-in corruption detection facility.

My problem now is that I really don’t want to open and test each and every single archived file throughout my drive; that would be a nightmare. I’m looking for a utility that can automate the process.

Is there a program that can scan archive files on a drive and list the ones that are corrupt? Ideally it would be able to take plugins so that it can support additional, less common archive types such as LHA, UHA, ARJ, etc.

0

2 Answers 2

1

If you get the command line version of 7-Zip (7za.exe) and put it somewhere on your system path (like C:\Windows), the following script might work as a baseline:

@echo off
set DownloadPath=C:\Path\To\Downloaded\Stuff
set ErrorReport=C:\Path\To\BadFiles.txt
pushd %DownloadPath%
for /r %%i in (*.7z;*.zip;*.cab;*.rar;*.ace) do (
    7za.exe t "%%i"
    if ERRORLEVEL 1 echo %%i>>%ErrorReport%
)
popd

Copy and paste the above into a .cmd file, making sure to modify the set DownloadPath= and set ErrorReport= lines to point somewhere valid. The ErrorReport file will be created if it doesn't exist, and will be appended to if it already does. So you could run the script once, modify DownloadPath, and run it again without losing your previous results.

If you'd just like to check every file without restricting the extensions, you can replace the *.7z;*.zip... with *, so the for line would read: for /r %%i in (*) do (

1
  • Thanks, I’ll try that out. However it looks like I’ll end up having to write a program myself (as is far too often the case).
    – Synetech
    May 1, 2010 at 16:56
0

The program for scanning archive files on a disk (and I presume you mean the zip, rar, 7z, exe, ace, and the likes) is called a script.

You could use 7-zip to test each archive in a loop that looks for all archive files. You will still need to wait for the test to execute on each file -- so the only thing you saved is live-donkey-work of actually testing each individually.

Like Molly has commented, the right way to store archives is to keep an MD5 sum along with the file. Many times you also get it ready with the executable files you download. If you start keeping MD5 sums (or any other checksums) with the files, checking would be a matter of re-computing the MD5 sum and comparing with the stored value. This will be considerably faster than a archive test (MD5 is known to be fast).

7
  • +1 7-zip can also test certain types of installers.
    – Molly7244
    Dec 4, 2009 at 2:06
  • @Molly, yes, installers that package with standard compressed formats. You can also extract the files without running these installers.
    – nik
    Dec 4, 2009 at 2:12
  • btw: ace is not handled by 7-zip...
    – nik
    Dec 4, 2009 at 2:13
  • good comment about MD5 sums, but an initial test with 7zip can be very helpful. a lot of sites don't bother posting MD5 sums for their downloads -- so download, test with 7zip, then compute the MD5 and store. Dec 4, 2009 at 2:36
  • @quack, Yes, the idea is to prepare for our future interests of checking file integrity fast by keeping our MD5 computations of the verified file handy. That is what I wrote (and what Molly suggests too). That will save you from doing a archive-test execution the next time.
    – nik
    Dec 4, 2009 at 4:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .