cfv

Versatile checksum file verifier and creator

TLDR

Verify files against a checksum file in the current directory
$ cfv
Create an SFV checksum file for all files in a directory
$ cfv -C -t sfv -f [checksum.sfv] [path/to/directory/*]
Create an MD5 checksum file
$ cfv -C -t md5 -f [checksum.md5] [path/to/files/*]
Create a SHA1 checksum file
$ cfv -C -t sha1 -f [checksum.sha1] [path/to/files/*]
Verify and show status for each file
$ cfv -v [path/to/checksum.sfv]
Recursively verify all checksum files in subdirectories
$ cfv -r
Search for misnamed files when verification fails
$ cfv -s [path/to/checksum.sfv]

SYNOPSIS

cfv [-T|-C] [-t type] [-f file] [-r|-rr] [-v|-V] [-n|-N] [-s] [-u|-uu] [files...]

DESCRIPTION

cfv is a utility for testing and creating checksum verification files. It automatically detects the checksum format when verifying, and supports a wide range of formats including SFV, MD5, SHA1, SHA256, SHA512, CSV, PAR/PAR2, and BitTorrent metainfo files.In test mode (default), cfv reads a checksum file and verifies that each listed file matches its recorded checksum. In create mode (-C), it generates a new checksum file from the specified input files. The tool can search for misnamed files, rename corrupted files, and recursively process directory trees.

PARAMETERS

-C

Create mode: generate a new checksum file.
-T
Test mode (default): verify files against a checksum file.
-t type
Checksum type: sfv, md5, bsdmd5, sha1, sha256, sha512, csv, csv2, csv4, crc, par, par2, torrent, auto (default, auto-detect).
-f file
Specify the checksum file to read or write.
-r
Recurse into directories. Use -rr to recurse into both files and checksum files.
-v
Verbose: print status for every file, not just errors.
-V
Disable verbose output (default). Use -VV to also suppress the status line.
-q
Quiet mode: suppress all output including error messages. Check exit status only.
-Q
Print only status lines, not individual errors.
-n
Rename files with bad checksums to filename.bad.
-N
Disable renaming (default).
-m
Check only for missing files without comparing checksums.
-s
Search for misnamed files when a file is not found.
-S
Disable search for misnamed files (default).
-u
Show unverified files. Use -uu to show unverified files in subdirectories.
-U
Do not show unverified files (default).
-i
Ignore case when matching filenames.
-l
Follow directory symlinks in recursive mode (default).
-L
Do not follow directory symlinks in recursive mode.
-z
Support gzip-compressed checksum files. Use -zz to force gzip on all checksum files.
-p dir
Change to directory before processing.
--strippaths n
Strip leading path components from filenames in test mode.
--progress val
Control progress bar display: no, auto (default), or yes.

CONFIGURATION

Configuration file at ~/.cfvrc contains default options (one per line, same syntax as command-line flags). Options on the command line override the config file.

INSTALL

brew install cfv
nix profile install nixpkgs#cfv

CAVEATS

PAR and PAR2 formats are supported for verification only, not creation. BitTorrent verification requires the original directory structure. Exit codes are bitwise-ORed: 2 (bad checksum), 4 (size mismatch), 8 (not found), 16 (file error), 32 (unverified), 64 (checksum file error).

HISTORY

cfv was originally written in Python as an open-source checksum verification tool. It gained popularity in the file-sharing community for its broad format support, particularly SFV and MD5. The project was later forked as cfv2 to maintain Python 3 compatibility after the original project became unmaintained.

SEE ALSO

md5sum(1), sha1sum(1), sha256sum(1), sha512sum(1), cksum(1), par2(1)