NAME

ffv - create or verify SFV or MD5 checksum files

SYNOPSIS

To verify files: ffv [-npw] [FILE ...]

To create a SFV file: ffv [-ahopw] -s OUTPUT.SFV [FILE ...]

To create an MD5 file: ffv [-ahopw] -m OUTPUT.MD5 [FILE ...]

DESCRIPTION

FFV creates or verifies checksum files. It supports CRC32 (SFV files) and MD5 files.

When verifying files, you can specify one or more checksum files or directories to check. (Specifying a directory checks all .SFV and .MD5 files in that directory.) The default is to check the current directory. Note: FFV looks for the files to check relative to the current directory, not relative to the directory in which the checksum file is stored (unless you use the --relative option).

When creating a checksum file, you can specify one or more files and/or directories to be listed in the checksum file. The default is to list all files and directories in the current directory. The checksum file itself is never included.

OUTPUT

When verifying files, FFV will report one of four states for each file mentioned in the checksum file:

  MISS  The file did not exist on your disk
  ERR   The file existed, but could not be opened for some reason
  BAD   The file existed, but the checksum did not match
   OK   The checksum matched

At the end, it will report the total number of checksum files, the number of checksum files which did not verify ok, and the total number of each kind of error.

Note that when the --no-verify option is used, "OK" means only that the file could be opened. The other states are the same as usual.

EXIT STATUS

FFV's exit status indicates whether the comparison was successful:

  0  All files had the correct checksum
  1  At least one file was missing         (MISS)
  2  At least one file did not match        (BAD)
  3  At least one file could not be opened  (ERR)
  4  An internal error occurred (should not happen)
  5  FFV was not invoked correctly

If there were multiple errors, the highest exit status wins.

OPTIONS

Options can be specified in any order and may come before, between, or after the filenames. Most options have both long and short versions. The short version is a single letter and is introduced by a dash. Several short options may be combined in a bundle (eg, use "-am" to append to an existing MD5 file. But don't use "-ma", because that will try to create an MD5 file named "a".)

The long version is introduced by two dashes and may be abbreviated.

"--" by itself means that all following arguments are filenames, not options. This is how you can specify a filename that begins with a hyphen. (The other way is to use a wildcard in place of the hyphen.)

 -m, --create-md5=FILE   Create an MD5 checksum file
 -s, --create-sfv=FILE   Create a SFV (CRC-32) file

    The -m and -s options tell FFV to create a checksum file instead
    of verifying one.  The checksum filename is specified
    immediately after the -m or -s.  If the checksum file already
    exists, you will be prompted for what to do unless you also
    specify the -a or -o option.

    All of the files specified on the command line will be added to
    the checksum file.  If you specify a directory, all files and
    directories in that directory will be added.  You may use the
    standard wildcard characters.

 -a, --append         Append to existing checksum file
 -o, --overwrite      Replace an existing checksum file

    These options apply only when you are creating a checksum file.
    -a means to add to an existing checksum file, while -o means to
    replace the existing file with a new one.

 -h, --hidden         Include hidden files when creating a checksum file

    Normally, FFV skips over hidden files when creating a checksum
    file.  The -h option tells FFV you want to include them.

 -n, --no-verify      Just check if files exist (don't verify checksums)

    The -n option tells FFV you just want to do a quick check for
    missing files.  FFV opens each file to make sure it exists, but
    does not compare the file's contents against the checksum file.
    This is much faster than the normal check, especially on large files.

 -p, --pause          Wait for keypress before exiting

    The --pause option is mainly useful if you want to associate FFV
    with .SFV or .MD5 files so that you can double click on them
    from Windows Explorer.  Otherwise, FFV would close before you
    could read the results.

 -r, --relative       Interpret paths relative to the checksum file

    Normally, when a checksum file contains relative paths (as it
    usually does), FFV looks for the files to verify relative to the
    current directory.  This makes it easy to validate files using a
    checksum file stored elsewhere.  The --relative option tells FFV
    to look for the files relative to the checksum file.  That's
    useful when the checksum file is stored along with the files to be
    checked, and you want to validate several checksum files in
    different directories.

 -e, --allow-errors   Don't stop if there's an error reading a file

    Normally, FFV will abort if there's an error reading a file.
    The -e option will cause it to print an error message and continue
    with the next file.

    If you're creating a checksum file, files that cannot be opened
    will not be listed in the checksum file.  Files that can be opened
    but cause an error during reading will be listed, with the
    checksum based on the part of the file that could be read.

 -w, --allow-writing  Process files that are being written

    Normally, FFV will not process a file which is currently open for
    writing by another program.  The -w option will allow other
    programs to write to the file while FFV is scanning it.  Of
    course, the checksum result may not be meaningful if the file
    changes while FFV is reading it.

    If you get the error message "The process cannot access the file
    because it is being used by another process", using -w will
    probably let you process that file.

 -?, --help           Display usage information
     --license        Display license information
     --version        Display version information
CONTENTS OF A CHECKSUM FILE

FFV distinguishes between MD5 and CRC32 checksums by the way they look. Checksum files are plain ASCII text files. Each line is treated separately, so one file could contain both SFV and MD5 style checksums. However, I don't know of any other program that supports files like that, so I don't recommend their use.

Lines that begin with a semicolon are comments, and are ignored.

SFV (CRC32) files look like this:

 filename1 F2A18225
 filename2 AF33EDF1

MD5 files look like this:

 MD5(filename1) = 1368de10845a69c06b43f110975f8eda
 MD5(filename2) = 723af1638ed180493e246579ffaf5a69

FFV also understands (but cannot create) files created by md5sum:

 1368de10845a69c06b43f110975f8eda  filename1
 723af1638ed180493e246579ffaf5a69  filename2

Note that the text/binary flag in md5sum files is ignored; FFV always reads files in binary mode.

BUGS

There is a bug on POSIX systems that don't use GNU libc (like Solaris). When creating a checksum file, FFV will include files in hidden directories. A patch to fix this is welcome (look at nftwCollectFunc in posix/misc.cpp).

If there are other bugs, it's much more likely that they would cause FFV to skip a file entirely or report it as bad when it's actually ok. If FFV says a file is ok, it most likely is.

If you're really sneaky, you can get FFV to try to create a self-referential checksum file. This won't actually work, of course. (It tries to skip the checksum file, but sometimes it doesn't recognize that two different pathnames refer to the same file.)

FFV can handle only about 2 billion files per checksum file.

The text/binary flag in md5sum files is ignored; FFV always reads files in binary mode. This is more of a design decision than a bug, however. Besides, md5sum files frequently fail to indicate binary files as such.

FFV does not support md5sum files that contain backslashes. This should not be a major issue, since md5sum is primarily a Unix utility, and backslashes or newlines in filenames are rare on Unix.

AUTHOR
 Christopher J. Madsen           <ffv .at. cjmweb.net>
 http://www.cjmweb.net/ffv/

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.