cfv man page

cfv — Verify file consistency with .sfv, .csv, .crc, .md5, md5sum, sha1sum, .torrent, par, or par2 files


cfv [-p dir] [-v|-V|-VV] [-r|-rr|-R] [-n|-N] [--renameformat <s>] [-s|-S] [-zz|-z|-Z|-ZZ] [-T|-C] [-m|-M] [-i|-I] [-u|-uu|-U] [--unquote <b>] [--fixpaths <s>] [--showpaths <i>] [--list/--list0 <l>] [--announceurl <u>] [--piece_size_pow2 <n>] [-t type] [-f file] [files...]


cfv verifies that the files you have are the same as those that the were used to create the checksum file.


Enable printing of extra messages.
Disable printing of extra messages. (default)
Like -V, but don't print status line at end either.
Like -VV, but not even error messages are printed. Check the exit status.
Only status lines are printed, but not individual errors.
--progress VAL
Set when cfv should display progress bars. If no, progress bars are never displayed. If auto, progress bars are displayed when the output is to a tty.(default) If yes, progress is always displayed.
Recursive mode 1. In create mode, make seperate chksum files for each dir.
Recursive mode 2. In create mode make a single file with deep listing in it. Both recursive modes are equivilant for test mode.
Disable recursive mode (default)
Follow directory symlinks in recursive mode. (default)
Don't follow directory symlinks in recursive mode.
Set test mode. (default)
Set create mode.
Check only for missing files (don't compare checksums)
Check checksums (default)
Rename bad files. With -s, also renames misnamed files to the correct name.
Don't rename bad files (default)
--renameformat string
Format string to use with -n option. Simply, put any of the 4 strings %(fullname)s, %(name)s, %(ext)s, and %(count)i in the format string, along with whatever other text you wish.
The default is '%(name)s.bad-%(count)i%(ext)s'
In detail, this is a standard python format string with mapping that contains {'fullname': original filename, 'name': fullname minus extension, 'ext': extension(including .), 'count': rename attempt}. If the format string does not contain count, then cfv will append '-%(count)i' to the filename if the first attempt fails.
Search for misnamed files. No effect in create mode. Also, keep in mind that using -m together with -s will do nothing if the checksum type doesn't include filesizes, and if it does, can give false positives if some files have the same size.
Don't search for misnamed files. (default)
Ignore case. Currently has no effect in create mode.
Don't ignore case (default)
Show unverified files. If no files in a directory are verified, shows dir/*. If no files in a directory or its subdirs are verified, shows dir/**. Has no effect in create mode.
Show each unverified file individually, no special directory handling. Has no effect in create mode.
Don't show unverified files (default)
Force making/reading checksum files as gzipped files, even if not ending in .gz (mainly useful for "-f -")
Make gzipped files in create mode.
Don't create gzipped files automatically. (default)
Never use gzip, even if file ends in ".gz".
--unquote BOOL
If yes, handle checksum files that were generated by buggy encoders that quote filenames in checksum formats that don't need it. Default is no, since quotes can be a valid character in a filename and we don't want to remove them if they are actually part of the filename.
--fixpaths string
Convert all occurances of any characters in string to the dir seperator for the current platform. No effect in create mode. Use an empty string to disable.
--strippaths VAL
Strip NUM leading components from file names in test mode. Similar to the -p/--strip options of patch. VAL may be 'none': leave exactly as is, 'all': strip everything but the filename, 0: strip the leading driveletter/slash (if any), 1+: strip this many path components in addition. The default is 0.
--showpaths VAL
Show paths in displayed filenames. VAL should be one of yes/1/no/0/auto/2 or absolute/relative, or one from first list and one from second joined by a -. For backwards compatability, 1=yes, 0=none, 2=auto. The default is auto-relative. Abrieviations are accepted. Examples: --showpaths=y-a always shows absolute paths. --showpaths=n never shows paths.
-p dir
Change to directory before doing anything.
-f file
Specify the name of the checksum file to test or create. If file is -, stdin (for -T) or stdout (for -C) will be used.
-t type
Specify the type of the file. Can be sfv, sfvmd5, csv, csv2, csv4, sha1, md5, bsdmd5, par, par2, torrent, crc, auto, or help. If the type is help, or an unknown type is given, a list of the types and their descriptions will be printed. The default is auto, which will detect the file type for you. When creating, if type is auto an sfv will be made, unless a different default has been set in the config file.
--list listset
Prints a raw listing of files in the given set (ok, bad, unverified, notfound). Usually used with -q, but not strictly needed since specifying --list will redirect all other messages to stderr.
--list0 listset
Like --list but files are seperated by a null char. Useful in combination with xargs -0.
--announceurl URL
Tracker announce URL for .torrent file creation.
--piece_size_pow2 N
Power of two to set piece size to for .torrent file creation. The default is 18, which gives a piece size of 2^18=256KB.
Print help info.
Print version of cfv and modules it uses.

sfv is a Simple File Verify format file
sfvmd5 is a Simple File Verify format file, using MD5 checksums rather than crc32.
csv is a Comma Seperated Value file, with the fields being name,size,crc32,
csv2 is a Comma Seperated Value file, with the fields being name,size,
csv4 is a Comma Seperated Value file, with the fields being name,size,crc32,path
sha1 is a sha1sum format file
md5 is a md5sum format file
bsdmd5 is a BSD md5 format file
par is parchive v1 format file (test-only)
par2 is parchive v2 format file (test-only)
torrent is a BitTorrent metainfo file
crc is a JPEG Sheriff format crc file

Exit Status

The exit status of cfv can be examined to determine what kind of errors, if any, occured.

An exit status of 1 indictates a command line argument error, or an unhandled exception.

Otherwise, the exit status will be a bitwise OR of:

badcrc (a file had a different checksum than listed in the checksum file)
badsize (a file had a different size than listed. Not all checksum file formats include file size)
notfound (a file that was listed was not found)
ferror (some other file error occured when trying to open/read a file)
unverified (a file was not verified, only with -u)
cferror (a checksum file was not found or not recognized)


Since different platforms represent the path seperator differently, using recursive mode 2 (-rr) is not recommended for anything other than personal usage. Although the addition of the fixpaths option can be used to work around this, it isn't guaranteed that whatever program others user have will have a similar feature.

The -s option is not currently implemented for .torrent files. (Unless you also use -m)


If no options are specified, the default will be -T -t auto, and it will search the current directory for any supported checksum files.

Force the file to test:
cfv -f funny.name

Test only the files you have, (avoid file not found errors):
cfv *

Create a csv file for all the files in the current dir:
cfv -C -tcsv

Create a csv file for only the zip files in the current dir, and specify the filename:
cfv -C -fsomezips.csv *.zip

Check if all files in current and subdirs are verified, but don't verify checksums of files that are. (For example, before writing a directory to a cdr and you want to make sure all the files are verified.):
cfv -r -m -u


Upon startup, cfv will test for ~/.cfvrc and if it exists, read configuration information from it. The file consists of any number of lines, each having a single option name and the value seperated by a space. Empty lines and lines beginning with a # are ignored.

Example Configuration

#this is an example .cfvrc that specifies all the default options
#don't be verbose (set to 1 or v for -v, 0 or V for -V, -1 or VV for -VV, -2 or q for -q, -3 or Q for -Q)
verbose V
#use progress meter when output is to a terminal (yes for always, no for never, auto for when output isatty)
progress auto
#create sfv files by default
default sfv
#sort dir listings before creating a checksum file
dirsort 1
#sort command line specified files
cmdlinesort 1
#expand wildcards in command line (yes for always, no for never, auto for when os.name is os2, nt, or dos)
cmdlineglob auto
#don't be recursive (set to 0 for -R, 1 for -r, 2 for -rr)
recursive 0
#follow symbolic links
dereference 1
#don't show unverified files (set to 0 for -U, 1 for -u, 2 for -uu)
showunverified 0
#don't ignore case
ignorecase 0
#don't use workaround for buggy encoders that quote filenames unnecessarily
unquote 0
#don't fix any paths (note that there is a single space after fixpaths, thus the value it gets set to is an empty string)
#A more useful example would be:
#fixpaths /\
#don't strip leading directories (all to strip all path info, 0+ to strip the leading / and the first X components, none for nothing)
strippaths 0
#show full paths in recursive mode (set to 0 for never, 1 for always, 2 for only in recursive mode)
showpaths 2
#access checksum filenames that end with .gz as gzipped files (-1 for never, 0 for with .gz, and 1 to make -C make .gz files automatically)
gzip 0
#don't rename bad files
rename 0
#format to use for renaming bad files with -n
renameformat %(name)s.bad-%(count)i%(ext)s
#don't search for files
search 0
#filename_type can be used to override what type of file to create when -t isn't specified.
#The format of the argument is <typename>=<regex>. Can be specified multiple times, the earlier instances having higher priority.
#for example, the following line would cause cfv -C -f foo.md5 to create a 'sfvmd5' file rather than a 'md5' file.
#filename_type sfvmd5=md5$

#torrent options:
# you can specify a default announce url:
#announceurl http://foo.bar/announce
# piece size of 2^18 bytes (256KB):
piece_size_pow2 18


cfv configuration file. See configuration section.
alternate configuration file name. (Since windows won't let you create files starting with a dot.)


Where to look for cfvrc file. Note that win9x doesn't set this to anything automatically.
Set to a non-empty value to disable usage of python-fchksum module.
Set to a non-empty value to disable usage of mmap.


Matthew Mueller <donut AT dakotacom DOT net>

The latest version can be found at any of:

Other programs I have written can be found at:

See Also

md5sum(1), sha1sum(1), md5(1), xargs(1)


Explore man page connections for cfv(1).