rik
(Recursive Integrity Keeper) is a Python wrapper around the
par2cmdline
tool. It allows recursive calculation and verification of
Reed-Solomon
error correction codes for your files. These codes can be used to restore file
content in case of damage, making rik
particularly useful for long-term
archiving.
To create error correction codes, run rik create -i par2 ./
in your
directory. rik
will recursively process the directory contents, generating
Reed-Solomon codes for each file it encounters. To verify the integrity of your
files with the generated codes, use the command rik verify -i par2 ./
.
At the end, the comprehensive summary of results will be printed. If any
corrupted files are found, the generated Reed-Solomon codes can be used to
restore them.
rik
uses par2cmdline as its
backend. Ensure that par2cmdline
is installed and available in your system's
PATH before proceeding.
To install the development version of rik
, use the following commands:
git clone https://github.com/usert5432/rik
cd rik
python3 -m pip install -e .
Alternatively, rik
can be installed from the PyPI repository:
python3 -m pip install rik
To calculate Reed-Solomon codes for a directory DIR
, run:
rik create -i par2 DIR
This command will recursively process the contents of the directory tree
starting from DIR
. For each file encountered, it will calculate Reed-Solomon
error correction codes and save them in a .par2
subdirectory next to the
original file.
To verify file integrity using previously calculated Reed-Solomon codes for a
directory DIR
, one can use:
rik verify -i par2 DIR
A comprehensive summary of the verification process will be printed at the end.
You can pass arguments directly to the par2cmdline
command. For instance, it
is possible to to specify redundancy level with:
rik create -i par2 DIR -- -r10
This argument will make par2cmdline
create 10% redundancy.
rik
supports several filters to include/exclude files based on their paths
and sizes. For example,
- Calculate error correction codes only for files smaller than 100 MB:
rik create -i par2 -s '<100M' DIR
- Calculate error correction codes only for files outside of
.cache
directories:
rik create -i par2 --exclude .cache DIR
This project is distributed under the BSD 2-Clause License - refer to the the LICENSE file for details.