Package: checksum-helper
checksum-helperConvenient tool that facilitates a lot of common checksum file operations.Features:Generate checksums for a whole directory tree either verifying files based on checksum files in
the tree or skipping unchanged files based on the last modification timeCombine all found checksum files in a directory tree into one common checksum file while only
using the most recent checksums and filtering deleted files (can be turned off)Check whether all files in a directory tree have checksumsCopy a hash file modifying the relative paths in the file accordinglyMove files modifying all relative paths in checksum files accordinglyVerify operations:Verify all hashes of a single fileVerify all checksums that were found in the directory treeVerify files based on a wildcard filterUsageUsechecksum_helper.py -hto display a list of subcommands and how to use them.
Subcommands (short alias):incremental (inc)build-most-current (build)check-missing (check)copy_hf (cphf)move (mv)verify (vf)For almost all commands the directory tree is searched for known checksum files.
This can be customized by specifying exclusion patterns using--hash-filename-filter [PATTERN ...]and the traversal depth can be limited with-d DEPTH.ChecksumHelper has it's own format that also stores the last modification time as well as
the hash type. If you want to avoid a custom format you can specify a filename with-o OUT_FILENAMEwhich has to end in a hash name (based on hashlib's naming) as
extension. Single hash files won't support emitting extra warnings when doing
incremental checksums or skipping unchanged files based on the last modification
time though.For the filter/whitelist/.. wildcard patterns:On POSIX platforms: only/can be used as path separatorOn Windows: both/and\can be used interchangeablyincrementalchecksum_helper incremental path hash_algorithmGenerate checksums for a whole directory tree starting atpath. The tree is searched
for known checksum files (*.md5, *.sha512, etc.). When generating new checksums
the files are verified against the most recent checksum that was found.--skip-unchanged: skip verifying files by hash if the the last modification time remains unchanged--dont-include-unchanged: Unchanged files are included in the generated checksum
file by default, this can be turned off by using this flag-sor--single-hash: Force writing to a single hash filebuild-most-currentchecksum_helper build pathCombine all found checksum files in a directory tree starting atpathinto
one common checksum file while only using the most recent checksums. By default
files that have been deleted inpathwill not be included which can be turned off
using--dont-filter-deleted.check-missingchecksum_helper check pathCheck whether all files in a directory tree starting atpathhave checksums
available (in discovered checksum files)copy_hfchecksum_helper cphf source_path dest_pathCopy a hash file atsource_pathtodest_pathmodifying the relative paths in
the file accordinglymovechecksum_helper mv root_dir source_path mv_pathMove file(s) or a directory fromsource_pathtomv_pathmodifying all relative
paths in checksum files, that were found in the directory tree starting atroot_dir,
accordingly.Make sure to be careful about choosingroot_dirsince relative paths to the moved
file(s) won't be modified in parent directories.verifyFor all verify operations a summary containing theFAILED/MISSINGfiles
and the amount of total files, matches, etc. are printed so you don't have to
go through all the logs manually.Verify operations:allchecksum_helper vf all root_dirVerify all checksums that were found in the directory tree starting atroot_dirhash_filechecksum_helper vf hf hash_file_nameVerify all hashes in a checksum file athash_file_name.filterchecksum_helper vf filter root_dir filter [filter ...]Verify files based on mutiple wildcard filters such that only files matching
one of the filters is verified, assuming there is a hash in a checksum file
somewhere inroot_dirfor it.Example:checksum_helper vf filter phone_backup "*.jpg" "*.mp4" "Books/*"This would verify alljpgandmp4files as well as all files in the
sub-directoryBooks(as long as there are checksums for it inphone_backup)