CHKFILES
Version 1.0a
Release date: Feb. 23, 1996
Copyright 1996, Stochastic Systems

What is CHKFILES?

CHKFILES is a program that creates a special file in every directory that you
select (which could be every directory on your hard drive).  This file, which
is named CHKFILES.CHK, contains the name, time, date, size, and checksum of
every file in the path.  On subsequent runs, if the CHKFILES.CHK file already
exists in a path being checked, all files will be checked and the CHKFILES.CHK
file will be updated.  You will be informed of every new path where a new
CHKFILES.CHK file has been created, and, for every old path, you will be
informed of every new file in the path, every file that has been deleted from
this path, every file that has been changed (change in time and/or date and/or
size), and any files that haven't changed time, date, or size but have a
different checksum (bad files).  You can select paths either recursively
(where selecting "C:\" will select every path on partition C) or
non-recursively (where selecting "C:\" will only select the root path of
partition C).

Since the CHKFILES.CHK file is stored at the path level, it remains valid even
if you move it and all the files to another path.  The CHKFILES.CHK file is in
pure ASCII format, so you can print it or edit it or use it for other
purposes.

==========================================

Who can use CHKFILES?

CHKFILES is released as shareware and is licensed for individual use.
Individuals may use CHKFILES for evaluation on their personal computers.  If
they keep using it, they are expected to pay for it.  (See the final section,
"How do I pay for CHKFILES".)

Business, Commercial, Educational, Institutional, Corporate, or Government use
of this version of CHKFILES is not allowed.  Contact Stochastic Systems if you
wish to include a special version of CHKFILES with some commercial product.
The only exception to this is that venders of shareware programs may include
the CHKFILES.EXE program and this text file as a shareware package being
distributed.  This means that you can include the CHKFILES package on a disk
of other shareware that you are selling, but you can not use CHKFILES as a
file checking program to check for corruption in the files on the disk of
shareware that you are selling.

CHKFILES is distributed "AS-IS".  No warrantee is expressed or implied,
including fittness for any purpose.  Stochastic Systems will not be
responsible for any damage caused by the use, misuse, or abuse of CHKFILES.

==========================================

Why should I use CHKFILES?

Do you run your system with VERIFY turned OFF to save time?  When you do a
tape backup, do you leave the auto-compare turned off?  If you answered yes to
these questions, then you probably can't be bothered with a utility that, if
your system is working 100% perfectly, may be just a waste of time.  BUT...
if you would rather have some peace of mind, read on!

Situation 1a: You have a beautifully designed Summer Solstice Card on your
computer that you use every year during that hurried summer holiday season.
Sometime in August, after the holidays are over, this file is corrupted by
that game you downloaded, tried once, and then erased.  Since you won't be
Solstice Cards until next June, you don't notice the corruption.  You do your
daily backups, your weekly backups, and your monthly backups.  Eventually,
this corrupted file gets backed up to all of your tapes.  Next June, when you
go to mail merge your database with your wonderful card, you notice the
corruption.  You search all of your tapes and disks, and all you can find is
the corrupted file.  Too bad you didn't have any way to know that it had been
corrupted before you overwrote all your good backup copies!.  If you had used
CHKFILES at least once before the file had been corrupted, then the first time
you used it after the file had been corrupted it would have warned you about
it, in time to retrieve a good version from your backup tape.

Situation 1b: Instead of being corrupted, the file was somehow deleted.
CHKFILES, by keeping track of what files are supposed to be in the directory,
would tell you that the file had been deleted the next time you ran it.

Situation 2a: While you were away from your desk at work, your boss, needing to
write a quick note, used your computer to type in and print out a message to
the accountant about how wonderful your work was.  The file is accidentally
stored deep inside the directory that holds all of your fonts.  (You happened
to be working on font editing before you were called away from your desk.) You
never would have found it, but with CHKFILES you see that one of the new files
on your computer is a text file inside the font directory.  That looks
strange, so you look at the file and learn that now would be a great time to
ask for a raise!

Situation 2b: Instead of being a file that you didn't expect to be there, it
is a file that you wrote containing important client information, but you
forgot where you stored it.  By using CHKFILES, you can get a list of all the
new files on your computer and easily find what you need.

==========================================

How do I use CHKFILES?

CHKFILES.EXE is a self-contained program.  It runs under Windows 3.1 and
higher.  It runs under Windows 95 (or at least it did last week!), though it
uses the short file names.  (If you want a version that uses the long file
names, send me money so I can upgrade my compiler.) The only external file
that should be in the same directory is the CHKFILES.PTH file, which is
created by the CHKFILES program if you check the "Save Paths" box.  To run
CHKFILES, either run it from "Run" in the program manager, double-click on it
from file manager, or assign it to a program group in program manager.

When CHKFILES runs, it first looks for a CHKFILES.PTH file in the same path.
If it finds this file, it will attempt to open it and read the last paths and
settings that were used.  If there is no CHKFILES.PTH file, which there won't
be the first time you run CHKFILES, the program will come up with no paths
selected.

If you want to save the paths that you select so that they will be there the
next time you run CHKFILES, simply check the "Save Paths" box before you click
on "Begin".

If you want to select every path on your C drive, select the C drive in the
drive select box (upper left), click on the [..] entry in the directory select
box until the root directory is displayed, and then click on the "Add Path"
button.  An entry for "C:\" should appear in paths list box.  Make sure that
the "Recursive" box is checked.

When you change drives in the drive select box, the directory box will be
updated to show the subdirectories that are in the current path on that drive.
The current path is shown at the top of the screen.  The "Add Path" button
adds the current path to the path list box.  If the recursive box is checked,
any path that is already included inside a path that is already in the path
list box will be removed from the path list box.  Duplicate paths are removed.
Paths are shown sorted alphabetically.

If you click on the recursive box when it is not checked, it will become
checked and any now-redundant paths will be removed from the list box.  If you
click on the recursive box when it is checked, it will become clear and all
paths in the list box will be automatically expanded to show all paths inside
of them.  This could take a few seconds if you have many paths on your hard
drive(s).

To remove files from the list box, simply click on them.

If you want to quit from CHKFILES without checking any files, click the "Quit"
button.  Any changes you made to the path list will be ignored.

Once you have all the paths set up the way you want them, click the "Begin"
button.  If the "Save Paths" button is checked when you click on the "Begin"
button, the paths and recursive state will be stored in the CHKFILES.PTH file
located in the same path as the CHKFILES.EXE file.

If the "Recursive" box is checked when you click the "Begin" button, all the
paths in the list box will be expanded to include all subdirectories.  This
may take a few seconds.  You won't hurt anything by scrolling through the list
box as it is being expanded, though this may slow things down a bit.  (Path
delete is disabled while this expansion is taking place, so you don't have to
worry about it.)

After the path list box has been expanded (if necessary), the screen will be
reconfigured to show five empty lists and then the file checking will start.
The caption of the window will show the name of the current path being
checked.

The first list shows the new paths being checked and the new files in old
paths.

The second list shows the names of all files deleted from old paths since
CHKFILES was last run.

The third list shows the names of files that have changed since CHKFILES was
last run.  If the line with the file name starts with "L!:", this means that
the file has changed in length but not time or date.  If the file changed in
time and/or date, the file name will be listed without any prefix.  (Normally,
when a file changes at all the time changes.  It is somewhat unusual for a
file to change in size without changing time or date, which is why this is
flagged so you can know what is going on.)

The fourth list box shows the names of any files that are "bad".  A "bad" file
is defined as one that has a changed checksum but not a changed time, date, or
size.  "Bad" files will not be updated in the CHKFILES.CHK file, so if a file
shows up as "bad", the old checksum of the file will remain in the
CHKFILES.CHK file and not be updated to the checksum of the file as it now
stands.  This is so you can restore this file from your backup (you DID keep a
backup, didn't you?) and then re-run CHKFILES to make sure that your backup
was good.  In the odd case where the file was changed intentionally somehow
without changing the time, date, or size, and you don't want to do anything
about it, then you will just have to ignore the "bad" reading.

The fifth list box shows any errors that happened during the running of the
CHKFILES program.

During the check procedure, you can click on the "Abort" button.  This will
abort the procedure after the current file is finished (which can take a few
seconds if the current file is large).  The current path being worked on will
not be updated.  If the current path is a new one, then no CHKFILES.CHK file
will be created in this path.  If the current path is an old one, then the
CHKFILES.CHK file will not be updated.  All previously checked paths will have
been finished correctly.

When the last path is checked (or the abort button is pressed), the bottom of
the screen will show some statistics, which will include the total number of
files checked, the numer of new files, number of deleted files, number of bad
files, number of updated files, total number of bytes checked, time it took to
check these files, and number of bytes per second.

When the "Done" button appears, all checking is finished.  Clicking on the
"Done" button will end the program.

CHKFILES was written to be very "multi-tasking friendly".  You can run
CHKFILES in the background, minimized if you like, while you run other things.
You shouldn't be changing, creating, or deleting files in the paths that
CHKFILES is looking at, but you can certainly play Solitaire while checking
your files.

==========================================

When should I use CHKFILES?

Any time you want to!  _I_ use CHKFILES at the following times:

 - Before a backup, so the backup will contain updated CHKFILES.CHK files and
so I know if any files are bad or have been deleted so I can restore them
before I do my backup and so I can see if there are any new files that I don't
need and want to delete so they don't waste space on my backup.

 - After defragmenting, so I know if any files were corrupted by the process.
I always backup before defragmenting, and I always run CHKFILES before backing
up, so I know that the files weren't corrupt before defragmenting.

 - After moving large blocks of files from one partition to another or to a
new hard drive.  When I bought a larger hard drive, I ran CHKFILES (and
backup), then copied all the files over to the new hard drive, and then ran
CHKFILES again before deleting the old hard drive.

When do other people use CHKFILES:

I don't know.  If you find an interesting use, please let me know!

==========================================

Why did I write CHKFILES?

Because I wanted a program that would do this sort of thing and I couldn't
find one.  There may be some other program out there that does the exact same
thing, but I don't know of one that does what I want the way I want it.  I
also wanted something simple to write that I could use to try out the
shareware market.

A well-known anti-virus program from a software company in Washington does
something like CHKFILES - it creates a small file in every path with checksums
in it - but it didn't do this in the way I wanted it to, wouldn't give me the
information I wanted, and I couldn't get it to do only the paths I wanted.

Many years ago I attended a talk by a programmer who was describing his new
backup program.  It was called the "GOOD" backup program, and he made a strong
case about always doing a checksum of every file and checking each file before
storing it to the backup.  He used the story of a corrupt file that was used
only once a year not being discovered until it had been copied to all the
backup disks, thus making recovery impossibly.  I bought a copy of his
program, used it religiously, and was very glad every time it enabled me to
save a corrupt file.  This was for a different computer system, and the "GOOD"
backup program was not a big seller, but it made a big impression on me.

When I started using Windows, I wanted the same sort of protection, but I
couldn't find it.  I toyed with the idea of writing my own version of "GOOD",
but since tape backup was so much more convenient, I decided to write CHKFILES
to add the protection I wanted without having to rewrite the entire backup
program.

The first version was done in Visual Basic version 3.  It worked, but it was
slow doing the checksums on the files and had some problems with certain
"unusual" date combinations.

I then moved the checksum routine to a DLL written in Turbo C++ 3.1, and that
sped things up quite a bit.  (The checksum routine is now so fast on a modern
computer that the slow part is reading the file off of the hard drive.  I was
thinking of optimizing the checksum routine in assembly language, but that
wouldn't make much difference.)

When I thought about releasing CHKFILES as shareware, I wanted it to be a
self-contained executable without requiring any external DLL's.  For this
reason I translated it into Turbo C++.  (I also wanted to have a project so I
could learn Windows programming in C++.) I then updated to Borland C++ version
4.0, which allows the program to easily release time to other tasks when it is
busy doing something complicated.  This allowed me to play Freecell while the
files were being checked.

The concept and basic structure of CHKFILES seems very solid.  I have been
using it on multiple machines for over 3 years now.  The C++ version also
seems very solid, though there are a few areas that are not fully
"idiot-proof".  See the next section.

==========================================

How dangerous is CHKFILES:

I have taken many precautions to avoid potentially dangerous situations.  If a
path already contains a file named CHKFILES.CHK, but it is not a file that was
created by this program - say for some strange reason you saved your favorite
apple pie recipe in a file of this name - you will get an error message that
this path can't be processed and your pie recipe will not be touched.  (If
your pie recipe file happens to be in the same format as a CHKFILES.CHK is
supposed to be in, then it will get modified.)

If your hard drive is so full that it doesn't have room for the CHKFILES.CHK
files, the program may crash, but it shouldn't do any damage (other than
filling up what little space you had left).

The contents of the CHKFILES.CHK file that is being created or updated is kept
in memory until the entire path is finished, and then the file is created and
re-written.  If the system crashes during the path checking, the old
CHKFILES.CHK file will remain intact.  If the system crashes during the short
time that the CHKFILES.CHK file is being written, it is possible that a
corrupt or incomplete CHKFILES.CHK file will be in the path.  In this case,
this path may give an error message the next time you try to check it.  The
corrupt CHKFILES.CHK file will not be deleted automatically, because the
program doesn't know if this corrupt file is really a corrupt file or your pie
recipe.  You would then have to manually delete this corrupt file and recheck
that path.

There are limitations on the number of paths that you can check in one run of
CHKFILES.  The paths are stored in a standard Windows list box, and these list
boxes can't hold more than 32K of text.  Assuming 32 characters in the average
path, this means you couldn't check more than 1000 paths in one run.  You
could, however, run CHKFILES multiple times with different sets of paths.  I
have lots of files and haven't run into this problem yet.

Because of the same listbox limitation, if you have too many new, changed,
deleted, or bad files, the list boxes may overflow during checking.  (This is
one reason when an entire path is new it only generates one line saying "All
files in path X" rather than a line for each new file.) If, for example, you
have thousands of picture files in multiple directories that have already been
checked and have CHKFILES.CHK files in them, and then you run all of these
picture files through a program that creates thumbnail files for each picture,
you could end up with so many new files in old paths that the "new files" list
box would overflow.  This _has_ happened to me!  All you would have to do is
simply run chkfiles again.  The paths that were completely checked before the
overflow would not cause any new file messages, the path that was being
checked during the overflow would be rechecked (its CHKFILES.CHK file would
not have been overwritten since this doesn't happen until the entire path is
finished being checked), and subsequent paths would then be checked until
either all of them were done or another overflow occurred.  As long as this
overflow happened further along in the list of paths, you could simply re-run
CHKFILES until the overflows stopped happening.  I realize that this is not
the best solution, but it happens so rarely that I can live with it.  (If
_you_ can't live with it, see below.)

==========================================

What should I not bother complaining about:

CHKFILES was designed to be a self-contained executable.  As such, it doesn't
use or need any external files (except the CHKFILES.PTH file to store the
paths and all the CHKFILES.CHK files in the paths, but it creates these for
you).  Because of this goal, CHKFILES does not use any of the currently
fashionable "3D" buttons or other fancy stuff.  This is not because I couldn't
figure out how to use such things.  Borland makes it very easy to use fancy
looking controls, in fact it takes a little more work to get a plain dialog
without the fancy features!  If there is enough demand for it (from paying
customers) I could easily add such things.

CHKFILES was designed to be easy for ME to use.  I use a mouse to run it.  I
realize that someone who tries to use the keyboard will have a very hard time
of it.  Specifically, with the keyboard it is not possible to select
individual items in the directory and paths list boxes.  Since I didn't want
to have to double-click on items with the mouse to select them, that meant
that keyboard use would be restricted.  Sorry.  (The earlier version in Visual
Basic required double clicking, and I didn't like that.) Windows is hard
enough to use with just a keyboard that I figure that not enough people will
need to use the keyboard to make it worth while.  If this causes anyone real
problems, please let me know.  I have some ideas on what to do about this, but
if no one needs it, I won't bother with it.

==========================================

What is in the future for CHKFILES:

CHKFILES is shareware.  This is my first venture into Windows-based shareware,
though I have a different shareware program on another platform and have
actually received some payments for it (though not that many).  I am not
planning on getting rich from this program, but if I make enough I will keep
supporting it and maybe do some other programs.  My primary goal is to justify
upgrading to Borland C++ version 5.0.  If I get enough support to do this,
then there will be a version 2.0 of CHKFILES that handles the long file names.

There are some enhancements that I plan on adding to CHKFILES.  I may release
a version 1.1 if I get much response from version 1.0.  Some of the plans I
have include adding things that happen when you click on files after the
checksum phase is over (or possibly during it).  For instance, if you clicked
on a file marked "Bad" you could get the option of marking the file as good
and updating the CHKFILES.CHK file.  If you got an error saying that a
CHKFILES.CHK file was corrupted so it couldn't process a path, you would get
an option to delete the CHKFILES.CHK file and reprocess that path.  If you got
an error due to an overflowing list box, it could pause for you to read all
the list boxes and then clear their contents and continue.  If you have other
things you would like, let me know.

==========================================

How do I pay for CHKFILES:

If you like CHKFILES, use it and share it with your friends.

If you really like it, I ask for a donation of US$10 or whatever you think it
is worth.  If you are from outside the U.S., please make sure that your
monetary instruments are easily cashable in the U.S..  Since CHKFILES is fully
functional as it stands, there is no registration "key" that you need back
from me.  (Sorry, the initial startup screen can't be disabled.) Maybe in the
future, if there is an installed base of registered users out there, I will
add some features that can only be activated by a key.  If this happens, I
will contact you with your key and where you can get a copy of the updated
file.  Because of this possibility, please send me some way to contact you
(email preferred) and also let me know where you got your copy of CHKFILES so
I know the best way to release updates so you can receive them.

If you use CHKFILES and don't pay for it, and then later it saves you from
losing something important, I would expect you to pay for it.

If you use CHKFILES and don't pay for it, and you find that it gives you
pleasure and peace of mind every time CHKFILES tells you that all your files
are safe after you do something like copy them over or defrag your hard drive,
then I would expect that after a while that peace of mind would be worth
paying for.

If you use CHKFILES and give it to your friends and brag about what a
wonderful program it is, you would pay for it.  Then you could brag about what
a wonderful person you are because you paid for what you used, and you could
shame all of your friends into doing the same thing!

If you have never experienced that warm fuzzy feeling that comes from knowing
that you have done a good thing, I would recommend that you pay for CHKFILES.
It's cheap, as far as shareware goes, and if you get that fuzzy feeling then
you can get it again by registering other shareware you use!  (If you don't
get that fuzzy feeling, or don't like it, then you won't be out as much as you
would be if you had registered a more expensive program!)

You may mail your money to:

Ron V. Webber
Stochastic Systems
P.O. Box 925
Dryden, NY 13053 USA

Make your checks or money orders payable to "Stochastic Systems".

I can be reached by email at:  ym@lightlink.com

My web page isn't ready yet.  When it is, and if anyone registers, it may
contain updated versions of CHKFILES.

I am interested in knowing who is using CHKFILES.  If you find an interesting
use that I didn't think of, let me know by email.  If you have sent me money,
let me know that it is on the way.  If you find a bug or could recommend a new
feature, let me know.  If you think it is stupid and a waste of your time,
don't bother to let me know.

I would also be interested in hearing ideas for more projects, job offers,
donations, praise, etc..  Sorry, no marriage proposals accepted.  (My wife
wouldn't like that!)
