How to Test Multiple RAR Archives with Unrar
Testing the integrity of multiple RAR archives ensures files are free
from corruption before extraction or long-term storage. This guide
explains how to verify a massive batch of archives simultaneously using
a single unrar command, complete with recursive folder
scanning and automated error logging.
The Single Command
To test an entire batch of RAR archives at once, open your terminal or command prompt, navigate to the target directory, and execute:
unrar t -r "*.rar"Command Breakdown
t(Test): Instructsunrarto verify archive integrity. It simulates the extraction process in memory and validates CRC checksums for every compressed file without writing data to the disk.-r(Recurse subdirectories): Directs the command to search through the current directory and all child folders."*.rar": The wildcard specifies every RAR file. Quoting the wildcard is essential on Unix-like systems (Linux and macOS) so the shell passes the pattern directly tounrarrather than expanding it beforehand. This prevents "argument list too long" errors when dealing with tens of thousands of files.
Optimizing for Massive Batches
Testing thousands of files can clutter your terminal with standard output. You can streamline the process by suppressing unnecessary text and capturing errors directly into a log file.
Use the -id (information display) switches to suppress
normal output:
unrar t -r -idq "*.rar" > test_errors.log 2>&1-idq: Runs in quiet mode, displaying only warning and error messages.> test_errors.log 2>&1: Redirects both standard output and error messages into a file namedtest_errors.log.
Checking the Results
If the process finishes with an empty log file, all archives passed integrity verification.
On Linux or macOS, you can quickly check the final exit status by running:
echo $?- 0: Successful operation with no errors.
- 1: Non-fatal errors encountered.
- 2: A fatal error occurred.
- 3: A CRC error was found (corrupt archive).
- 4: Attempted to modify a locked archive.
- 5: Write error.
- 6: Open file error.
- 7: Wrong command-line options.
- 8: Not enough memory.