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.

Journeyman Geek
  • 127,463
  • 52
  • 260
  • 430
Synetech
  • 68,243
  • 36
  • 223
  • 356

2 Answers2

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 (

afrazier
  • 22,987
  • 3
  • 60
  • 88
  • 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 01 '10 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).

nik
  • 55,788
  • 10
  • 98
  • 140
  • +1 7-zip can also test certain types of installers. –  Dec 04 '09 at 02:06
  • @Molly, yes, installers that package with standard compressed formats. You can also extract the files without running these installers. – nik Dec 04 '09 at 02:12
  • btw: `ace` is not handled by 7-zip... – nik Dec 04 '09 at 02: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. – quack quixote Dec 04 '09 at 02: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 04 '09 at 04:21
  • As mentioned, checksums are not available for every single file that you can download on the Internet (especially ones that were downloaded 10 years ago).
    I know that I could use a script (and may end up having to write one—I’m already fleshing out the details in my mind), but I was hoping that there were some program in existence that could scan all files on a drive, log the test results to a file, so that the “donkey-work” (of enumerating files, testing, and logging) could be avoided.
    – Synetech Dec 04 '09 at 18:03
  • Alternatively, you can use software like quickpar to create a recovery file, which will then allow you to detect bit-rot, and **fix** it if the damage is limited. – Fake Name Mar 13 '10 at 10:13