Home Applications / Software Testing RAR archive files for corruption in Mac OS X

Testing RAR archive files for corruption in Mac OS X


The easiest way I have found for testing RAR archive files in Mac OS X (whether testing a single or files split batches of rar parts) is to use the command line UnRAR tool. Unlike most of the GUI unarchiver tools I have tested on Mac, the command line tool gives a full report of each RAR part and whether it is corrupt or not. RAR files have an inbuilt CRC record, to the UnRAR tool will test the CRC against the file. Here’s how to do it:

Step 1

First off, follow the instructions on my earlier post for how to install the UnRAR command line tool into Mac OS X.

Step 2

TIP: The following commands require entering file paths into Terminal. You can either type these paths in by hand or do this: Just locate the file in Finder, grab the file and drag it over to Terminal after you have typed in the command (along with one trailing space). The other option is if you have TotalFinder installed. This gives you a new Finder command called “Copy Path”. Very handy. But dragging and dropping works very nicely.

In Terminal.app type the following command:

unrar t /path/to/files/archivename.rar

If you have a batch of split RAR files, enter the path to the first one in the batch. It is usually the one with the .rar file extension. The next files in a batch typically have the extension .00 and then .01 etc.

UnRAR will go through the whole batch of files, including their contents of the RAR files, and test them for corruption.

This way if your batch of RAR files won’t extract, you only have to re-download the files that are damaged and not the whole lot.

Of course you can also use this command line tool to perform the extraction. Just use the same command but replace the t with an x.

NOTE: You will need to first change the current directory to the one you want to extract the RAR archive into. The first line in the following example does exactly that. You’ll need to replace the path with the correct one for your situation. Remember you can create the extraction folder in Finder and then drag that folder into Terminal after you’ve typed the first part of the command (and followed it with a trailing space).

Something like:

cd /User/YourUsername/path/to/extraction-directory
unrar x /path/to/files/archivename.rar

cd means change directory.

Dealing with corrupt files

It is highly likely you can use RAR command line tools to repair the corrupt RAR files you discover. It’s explained in full in this post.

1 Comment

Leave A Reply

Please enter your comment!
Please enter your name here