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
  • 133,878
Synetech
  • 69,547

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
  • 23,505
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
  • 57,042