cfv(1)

๐Ÿ“ฆ version 3.2.0, in nixos 26.05, nixpkgs unstable, ubuntu stonking

๐ŸŒธ cfv(1) โ€” verify ur files, bestie ๐Ÿ’…

okay so, picture this: you've got a big ol' pile of files and a checksum file and you need to know if they match. That's cfv (short for "checksum file verifier", iykyk). It verifies that the files you have are the same as those that were used to create the checksum file. She speaks .sfv, .csv, .crc, .md5, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, .torrent, par, and par2. Versatile queen โœจ


โœจ SYNOPSIS โœจ

cfv [-p dir] [-v|-V|-VV|-q|-Q] [--progress VAL] [-r|-rr|-R] [-l|-L]
[-n|-N] [--renameformat <s>] [-s|-S] [-zz|-z|-Z|-ZZ] [-T|-C] [-m|-M]
[-i|-I] [-u|-uu|-U] [--encoding <e>] [--unquote <b>] [--fixpaths <s>]
[--strippaths <p>] [--showpaths <i>] [--list/--list0 <l>] [--announceurl
<u>] [--piece_size_pow2 <n>] [--private_torrent] [-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. That's it. That's the whole job. She's not doing your laundry, she's just checking ur vibes against a manifest ๐Ÿฆ‹


๐Ÿ”ฅ OPTIONS ๐Ÿ”ฅ

  • -v โ€” turn ON extra messages. chatty mode, we love her ๐Ÿ’ฌ
  • -V โ€” turn OFF extra messages. (this is the default, she's chill like that)
  • -VV โ€” same as -V, but she won't even print the status line at the end either. no little goodbye wave ๐Ÿ‘‹
  • -q โ€” like -VV, except not even error messages get printed. total silence. the way you find out what happened is by checking the exit status. no cap ๐Ÿ˜ถ
  • -Q โ€” only status lines print, individual errors do NOT. halfway quiet.
  • --progress VAL โ€” controls when progress bars show up. If no, progress bars are never displayed. If auto, they show when the output is going to a tty (this is the default). If yes, progress is always displayed. live your truth ๐Ÿ“Š
  • -r โ€” recursive mode 1. In create mode, she makes separate chksum files for each dir. one per folder, spreading the love.
  • -rr โ€” recursive mode 2. In create mode she makes a single file with a deep listing inside it. Both recursive modes are equivalent for test mode, so pick whichever, bestie.
  • -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) This is her main character era.
  • -C โ€” set create mode. time to build, not check ๐Ÿ—๏ธ
  • -m โ€” only check for missing files, don't actually compare checksums. (so u know what's gone, not what's wrong)
  • -M โ€” check checksums. (default)
  • -n โ€” rename bad files. With -s, she'll also rename misnamed files to the correct name. healing era ๐Ÿฉน
  • -N โ€” don't rename bad files. (default)
  • --renameformat <string> โ€” the format string used with the -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 a 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. ๐Ÿ’€ (don't overthink it, just vibe with the placeholders)
  • -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, it can give false positives if some files have the same size. so like, be careful ๐Ÿซฃ
  • -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, she shows dir/*. If no files in a directory or its subdirs are verified, she 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 they don't end 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 the file ends in ".gz". she said no ๐Ÿšซ
  • --encoding ENCODING โ€” specify the encoding to use when reading/writing checksum files. This can be any valid encoding name recognized by Python, or one of the following special values:
    • raw โ€” read/write as raw byte streams. May be useful for handling invalid filenames on disk or within a checksum file. (For text based checksum file formats, this is how cfv versions prior to 2.0 behaved.) vintage behavior ๐Ÿ“
    • auto โ€” the default. For checksum file formats that specify their encoding explicitly, that value is used. For text checksum file formats that start with a Unicode BOM (Byte Order Mark), the encoding is detected automatically. Otherwise, Python's notion of the users preferred encoding is used. she's perceptive like that ๐Ÿ”
  • --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. respect the quotes ๐Ÿซถ
  • --fixpaths <string> โ€” convert all occurrences of any characters in string to the dir separator 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 compatibility, 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. pick ur fighter ๐ŸฅŠ
  • -p dir โ€” change to directory dir before doing anything. get situated first ๐Ÿ 
  • -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. pipes, bestie ๐Ÿšฐ
  • -t type โ€” specify the type of the file. Can be sfv, sfvmd5, csv, csv2, csv4, sha1, sha224, sha256, sha384, sha512, 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 separated by a null char. Useful in combination with xargs -0. null-separated supremacy.
  • --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.
  • --private_torrent โ€” set the private flag in the torrent during .torrent file creation. ๐Ÿคซ
  • -h/--help โ€” print help info.
  • --version โ€” print version of cfv and the modules it uses.

๐Ÿซ– the tea on the types ๐Ÿซ–

  • 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 Separated Value file, with the fields being name,size,crc32,
  • csv2 is a Comma Separated Value file, with the fields being name,size,
  • csv4 is a Comma Separated Value file, with the fields being name,size,crc32,path
  • sha1 is a GNU sha1sum format file
  • sha224 is a GNU sha224sum format file
  • sha256 is a GNU sha256sum format file
  • sha384 is a GNU sha384sum format file
  • sha512 is a GNU sha512sum format file
  • md5 is a GNU 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, occurred. This is literally the whole point of -q, bestie โ€” she tells u everything thru the exit code ๐Ÿ’…

An exit status of 1 indictates a command line argument error, or an unhandled exception. (yes, that's 1 on its own, not a bitwise OR thing)

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 occurred 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)
so like, these stack! multiple problems = the numbers add up. 2 | 8 is 10. do the math, she trusts u ๐Ÿงฎ

๐ŸŒˆ NOTES ๐ŸŒˆ

Since different platforms represent the path separator 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. lowkey a portability moment ๐Ÿ˜ฌ

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 separated by a space. Empty lines and lines beginning with a # are ignored. so u can leave lil notes for urself in there, she won't judge ๐Ÿ“


โœจ EXAMPLE CONFIGURATION โœจ

okay bestie, here's a whole example .cfvrc that literally specifies all the default options. it's giving "just copy me" energy, and no cap, it's the whole thing:

#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

and that's the config, periodt. ๐Ÿ’…

๐Ÿ“ FILES ๐Ÿ“

  • ~/.cfvrc โ€” this is the cfv configuration file, bestie. see the configuration section for all the deets. ๐ŸŽ€
  • ~/_cfvrc โ€” alternate configuration file name. (since windows won't let you create files starting with a dot, which is lowkey tragic.) ๐Ÿ’€

๐ŸŒฟ ENVIRONMENT ๐ŸŒฟ

  • HOME โ€” where to look for the cfvrc file. note that win9x doesn't set this to anything automatically. (iykyk, retro struggle.) ๐Ÿซถ
  • CFV_NOMMAP โ€” set this to a non-empty value to disable usage of mmap. fr fr, no mmap. ๐Ÿšซ

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

  • Matthew Mueller <donut AT dakotacom DOT net>
  • Lisa Gnedt <cfv-project AT davizone DOT at>

the latest version can be found at: https://github.com/cfv-project/cfv

the original project can be found at: http://cfv.sourceforge.net/

๐Ÿ”— SEE ALSO ๐Ÿ”—

and that's a wrap on cfv(1), from 05 Feb 2005. it's iconic, it's classic, it's Unix. slay. ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from