NAME
cfv - Verify file consistency with .sfv, .csv, .crc, .md5, md5sum,
sha1sum, .torrent, par, or par2 files
SYNOPSIS
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...]
DESCRIPTION
cfv verifies that the files you have are the same as those that the
were used to create the checksum file.
OPTIONS
-v Enable printing of extra messages.
-V Disable printing of extra messages. (default)
-VV Like -V, but don’t print status line at end either.
-q Like -VV, but not even error messages are printed. Check the
exit status.
-Q 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.
-r Recursive mode 1. In create mode, make seperate chksum files
for each dir.
-rr Recursive mode 2. In create mode make a single file with deep
listing in it. Both recursive modes are equivilant for test
mode.
-R Disable recursive mode (default)
-l Follow directory symlinks in recursive mode. (default)
-L Don’t follow directory symlinks in recursive mode.
-T Set test mode. (default)
-C Set create mode.
-m Check only for missing files (don’t compare checksums)
-M Check checksums (default)
-n Rename bad files. With -s, also renames misnamed files to the
correct name.
-N 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.
-s 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.
-S Don’t search for misnamed files. (default)
-i Ignore case. Currently has no effect in create mode.
-I Don’t ignore case (default)
-u 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.
-uu Show each unverified file individually, no special directory
handling. Has no effect in create mode.
-U Don’t show unverified files (default)
-zz Force making/reading checksum files as gzipped files, even if
not ending in .gz (mainly useful for "-f -")
-z Make gzipped files in create mode.
-Z Don’t create gzipped files automatically. (default)
-ZZ 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.
-h/--help
Print help info.
--version
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:
2 badcrc (a file had a different checksum than listed in the
checksum file)
4 badsize (a file had a different size than listed. Not all
checksum file formats include file size)
8 notfound (a file that was listed was not found)
16 ferror (some other file error occured when trying to open/read a
file)
32 unverified (a file was not verified, only with -u)
64 cferror (a checksum file was not found or not recognized)
NOTES
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)
EXAMPLES
If no options are specified, the default will be -T -t auto, and it
will search the current directory for any supported checksum files.
cfv
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
CONFIGURATION
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)
fixpaths
#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
FILES
~/.cfvrc
cfv configuration file. See configuration section.
~/_cfvrc
alternate configuration file name. (Since windows won’t let you
create files starting with a dot.)
ENVIRONMENT
HOME Where to look for cfvrc file. Note that win9x doesn’t set this
to anything automatically.
CFV_NOFCHKSUM
Set to a non-empty value to disable usage of python-fchksum
module.
CFV_NOMMAP
Set to a non-empty value to disable usage of mmap.
AUTHOR
Matthew Mueller <donut AT dakotacom DOT net>
The latest version can be found at any of:
http://cfv.sourceforge.net/
http://www.dakotacom.net/~donut/programs/cfv.html
ftp://sunsite.unc.edu/pub/Linux/utils/file/
Other programs I have written can be found at:
http://www.dakotacom.net/~donut/programs/
SEE ALSO
md5sum(1), sha1sum(1), md5(1), xargs(1)
01 Feb 2005 cfv(1)