TreeCheck version 0.4

Introduction
============

TreeCheck is a diagnostic tool to help finding and correcting errors in
SafeStore Tree files.

SafeStore is a commercial back-up application sold by RComp Interactive.
If you do not run SafeStore this will be of no interest to you.

The Tree file in SafeStore is created for each back-up job. It records
the status of the area being backed up, specifically the directory structure
and the file names and timestamps. There are four types of record:

<root ...> which shows the root directory and is always the first record.
<dir ...> indicates a new directory (so we go down a level).
</dir> indicates the end of the current directory (so we go up a level).
<file ...> indicates a file, showing its name and timestamp.

The record types are indented to show the directory nesting level (2 spaces
per level). The root directory is at level 0 i.e. no indentation.

On my system at least, SafeStore occasionally reports:

Error: The file list has become corrupted - please use the Force Refresh option

"Force Refresh" forces SafeStore to rebuild the Tree file from scratch and
perform a whole new backup. For a large backup this can take a considerable
time. On the other hand trying to spot the errors in the Tree file is like
trying to find needles in a haystack. Once a corruption has occurred more
will follow at frequent intervals.

The corruption actually occurred during the previous run of the affected
job so it is difficult to get any useful evidence. If you retry the job
it will stop at the same point, and the SafeStore window will show the
number of files processed during the initial scan, at the point where the
first error was encountered. Unfortunately the file count doesn't equate to
the line number in the Tree file.

The type of corruption is that records are omitted from the file. In the
case of <file> records this doesn't matter much because next time around
the file will be identified as new and backed up.

If <dir> or </dir> records are missing then the directory structure is lost.
If a directory name is missing then all the pathnames within that directory
and any subdirectories are meaningless. You therefore need to examine your
actual file structure to find the missing names. Finding where you are in
the Tree file is very tedious because you may have to go back a long way.

That's where !TreeCheck comes in. I have always found the indentation level
to be correct. Therefore it can be checked. The indentation increases by
2 spaces after a <dir> and decreases by 2 spaces before a </dir> record.
If the indentation changes unexpectedly that's where the problem lies.

Installation
============

Copy the application somewhere, or run it straight from the zip file.

Operation
=========

Double click Select on the application icon.
!TreeStore runs in a new task window.
It lists all the backup jobs and invites you to enter a job number.
You do not need to type the leading zeros.

If you enter an invalid job number !TreeCheck won't find the Tree file
and you will get an error message.

!TreeCheck scans the Tree file (it does not look at the actual structure
of the source or target area). It will report the following errors:

Missing dir(s) at line ...
Missing /dir(s) at line ...
Unknown record type at line ... (tested but never found in the field).

!TreeCheck keeps track of the full current pathname. If a <dir> record
is missing it inserts the placeholder, "<-?->".

If a <dir> or </dir> is missing !TreeCheck prints the line number preceded
for <dir> by the current pathname. This makes it easy to find where it has
got to in your directory structure and thus find the missing directory name.

Please note that the pathname is the last one found and may not be the
parent directory of the missing one.

If you get a message "Incomplete file" this means that the indentation level
has not returned to zero at the end of the file.

On completion !TreeCheck reports "n error(s) found" where n
is a positive integer or 0. It also reports the number of lines. 

If errors were found you are invited to repeat the run for the same job.
Type "y" or "Y" to do so, otherwise just hit Enter.

Close the task window to finish.

Editing the Tree file
=====================

The Tree file is loacted at Choices:SafeStore.jobs.99999999.Tree
where 99999999 represents the job number with leading zeros.

!TreeCheck does not alter your Tree file. That is your
responsibility so if you're unsure make a copy first.

For a missing <dir> record you need to insert a line:
    <dir name="-----">
where ----- is the directory name you've just dug up.

For a missing </dir> you can insert it without further ado.

In both cases the appropriate indentation should be obvious.

After making the corrections repeat the run and it should report
0 error(s). Now you can retry the backup job.

Disclaimer
==========

You use this software and these instructions entirely at your
own risk. If you do find any errors or wish to suggest
improvements please mailto:rich@richardporter.me.uk .

NB I haven't checked for odd indentations but I have never
seen that to occur.

Richard Porter rich@richardporter.me.uk
