home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
UTILS2
/
OFCNHOME.ZIP
/
OFCNHOM.TXT
< prev
next >
Wrap
Text File
|
1994-01-12
|
53KB
|
1,181 lines
OOO FFFFF FFFFF III CCCCC EEEEE
O O F F I CC E
O O FFF FFF I CC EEE
O O F F I CC E
OOO F F III CCCCC EEEEE
'' NN N ''
'' N N N ''
'' N N N ''
N N N
N NN
H H OOO M M EEEEE
H H O O MM MM E
HHHHH O O M M M EEE
H H O O M M E
H H OOO M M EEEEE
Version 1.0
A file synchronizing tool
for people who have a PC
at home AND at the office
Program and documentation Copyright 1994
by Michael Meron, Hamburg, Germany
(CompuServe account# 100270,270)Foreword
I like PCs. I like them so much that I have one PC at the office
(the one I am earning my money with), and one at home (the one I
spend that money for). These two PCs are not yet connected (via
modems or whatever), so if I need to have certain data on both ma-
chines, I have to dance the "good old" diskette shuffle. But even
if I had a better link than that, one question would still remain:
Is there a way to start working on one machine, and continue work-
ing on the other one at any time still using the same data pool ?
Well, at least I have been careful to make that possible one day.
Every time I installed an application on both PCs, I used the same
directory structure on each of them (i.e., same directory names,
same number of subdirectories, same names for those subdirectories,
and same file names). Of course, there are also plenty of applica-
tions on either machine which I do not want to have on the other
one. Anyway--for the apps that I DO use on both computers, I take
care to have consistent directory structures and files.
Sounds familiar ? If yes, read on. What I am going to introduce to
you is a utility tailored to keep the files on those PCs "synchro-
nized".
Table of Contents
An Introduction to Office'n'Home. . . . . . . . . . . . . . 1
What is Office'n'Home, and what is necessary to run it? . . 2
Why is it Shareware?. . . . . . . . . . . . . . . . . . . . 3
How does Office'n'Home work ? . . . . . . . . . . . . . . . 4
Office'n'Home's Syntax: How to start the program and how to
set its parameters . . . . . . . . . . . . . . . . . . 6
How to set up your Backup Software. . . . . . . . . . . . . 10
Three working batch file examples . . . . . . . . . . . . . 11
Synchronizing different drives. . . . . . . . . . . . . . . 13
A day in the life of Mr. Sampleuser . . . . . . . . . . . . 14
What if...? . . . . . . . . . . . . . . . . . . . . . . . . 17
A definition of Shareware . . . . . . . . . . . . . . . . . 19
How to register, and where to find help . . . . . . . . . . 20
Disclaimer. . . . . . . . . . . . . . . . . . . . . . . . . 20
Trademarks and Copyrights . . . . . . . . . . . . . . . . . 21
An Introduction to Office'n'Home
Office'n'Home is a program that is dedicated to everybody to wants
to keep the directories and files of two or more PCs synchronized.
But what is "Synchronization"? As an informal definition, we will
say that two directories are synchronized if (and only if) they
have exactly the same entries. And two (or more) PCs are synchro-
nized if (and only if) all the directories that should be synchro-
nized are indeed synchronized. This makes it necessary for a
synchronizing program to make sure that...
a) files that have been newly created on one PC must be created
on the other PC, too;
b) files that have been updated on one PC must be accordingly
updated on the other PC;
c) files that have been deleted on one PC must be removed from
the other PC, too;
d) files that have been renamed on one PC must be accordingly
renamed on the other PC (automatically taking care of updates
that eventually occurred after the rename operation).
My particular situation is that I have a 386 with one hard disk at
the office (being a node in the company's Token-Ring/Novell LAN),
and a stand-alone 486 with two hard disks at home. On the office
PC, there are drive names from A: to Z:, two of them being of
special interest for me: First, the C: drive is the local drive,
where I am keeping the files I privately own (such as development
tools the company refused to buy for me). Second, the V: drive is
the part of the LAN server's very big hard disk where the files
reside that I must have access to. Given this, I must be able to
keep two things synchronized: Both PC's entire C: drives, and a
certain part of the office PC's V: drive against my home PC's D:
drive.
If your situation is principally similar, then Office'n'Home is one
for you, too. Of course, your individual configuration may look
very different. For example, there may be no LAN involved at all,
or you may want to have only certain directories synchronized, or
every directory except certain files (to keep your private
correspondence exclusively at home, for instance).
Most commercial backup utilities (such as Central Point Backup) are
able to partially give you synchronization; this partial approach
is normally called an "additive" or "incremental backup". Why is
this only a partial solution ? Well, from the postulates (a) to (d)
given above, you can instruct the utility to take care of (a) and
(b) for you, but not of (c). In the case of (d), things get even
more confusing as follows: Imagine you have a document file named
DRAFT.DOC on both PCs. Today, while you're working at the office,
you give it the "final touch", and make up your mind to rename it
to FINAL.DOC. Before you go home, you do an incremental backup to
diskette, and once arrived at home, you do a restore.
Oops! Now you have two documents at home (DRAFT.DOC has never been
deleted there, and FINAL.DOC has just been restored), while you
have only one at the office. Even worse: in case you had not yet
saved DRAFT.DOC on your home PC, then you will bring it back to
your office PC with your next incremental bakup. Voila, there it
will be again, grinning at you: "You did not really think you can
get rid of me, did you!?"
You bet this imagination was something I disliked. So this is,
finally, why I wrote oah: I needed it myself. And as I'm writing
this, I have been using it for more than a year.
What is Office'n'Home, and what is necessary to run it?
Office'n'Home is a DOS program that works in conjunction with a
backup utility of choice, and makes full file synchronization of
two PC's hard disks (or parts thereof) possible.
Office'n'Home has been tested to be compatible with MS-DOS 3.3,
5.0, and 6.0, and with Novell Netware 3.11. However, since
Office'n'Home accesses only very few basic DOS services (and only
well-documented ones), I am as confident as one can be that it runs
on other DOS or Network OS "flavors".
Be alarmed, however, to NEVER RUN Office'n'Home FROM WITHIN A
MULTITASKING ENVIRONMENT, such as Windows, DesqView, or OS/2! This
has nothing to do with Office'n'Home itself, but rather with the
way these environments are working. They all need "temporary
files", and in case one of those is accidentally deleted, unpre-
dictable things may happen. So if you're a Windows user, run it
before you start Windows, or afterwards. More about the do's and
dont's will follow later, in more detail.
As already mentioned, you need a backup program that is able to
save only those files whose "Archive Bit" is set (these are files
that are either new, or have been changed recently; you will find
more literature about the "Archive Bit" in your DOS manual). This
is no restriction, however, because since you have DOS, you also
already have a very well-suited (and well-documented) backup
"program": the XCOPY command! Please take the time now to browse
your DOS manual for the XCOPY command with the /A or /M parameter;
I will later assume that you know it.
Of course, any commercially available, dedicated backup program
(such as PC Backup, the Norton Backup, or Fastback, to name a few)
will do at least as well as XCOPY. In case you have the choice
between both a DOS and a Windows version of your backup program, I
recommend using the DOS version. A DOS program avoids having to run
Windows only for backup or restore purposes. But of course, both
"flavors" will do just as well.
Since Office'n'Home can delete files (to serve the list items (c)
and (d) in the introduction), I very strongly recommend you to have
a good un-delete utility installed, such as DATAMON with Delete
Sentry from the PC Tools. This is, of course, far more a general
recommendation for your everyday work, than a precaution due to
oah.
You should also have a good working knowledge of DOS. If you know,
for example, how to copy or delete a file or directory, then you
will feel comfortable with Office'n'Home. Of course, you should
also know your backup utility, at least good enough to know how to
create or restore incremental bakups. In the following text, I
will give you tips related to Central Point Backup V8 for DOS, but
I think you will be able to easily apply them to the program you're
actually using.
One last condition for using oah: You can place it, and run it
from, any directory on any drive you like AS LONG AS it is possible
for Office'n'Home to delete and re-create itself. This means that
if you chose a directory on a network drive, you must have "access,
read, delete, create, and write rights" for at least the file
OFCNHOM.EXE. But before you even start to worry if you have these
rights or not: better don't run Office'n'Home from a network drive!
On my office PC, I always run it from the local hard disk, from
where it can easily scan the network drives. It is also possible to
run it from a diskette, if everything else fails.
Why is it Shareware?
It may be unusual to have an excurse about Shareware at the
relative beginning of a documentation, but I felt that you ought to
know as soon as possible how to use Office'n'Home "officially". I
am trying hard to make both the program and its documentation as
usable as possible, and I just thought that if I am fair to you,
you will be fair to me. Okay - here goes:
This version of Office'n'Home is NOT public domain or free
software, but is "Shareware" (I'll assume here that you have at
least an informal understanding of what Shareware is. You can find
an exact definition at the end of this documentation). You may try
Office'n'Home out to see if it is useful for you. If you use it,
you must register and pay for one license per two CPU's (i.e., your
home and office PCs).
With the license,you will receive a version of the program that
does not any more show the Shareware info on-screen. More info
about how and where to license can be found at the end of this
documentation.
The program (in the form of the original archived file only) may be
freely distributed, but not sold (except under license; more info
individually upon request).
Non-registered users of this software are granted a limited 14 day
license to make an evaluation copy for trial use for the purpose of
determining whether Office'n'Home is suitable for their needs. At
the end of this trial period, you should either register your copy,
or discontinue using Office'n'Home.
How does Office'n'Home work ?
Office'n'Home works in two "passes". The first pass scans the hard
disk(s) of the PC it is currently running on for files that do not
exist on the other PC (i.e., when it is running on the home PC, it
searches files not existing on the office PC, and vice versa). It
does not touch entire directories that do not exist on the other
PC, even if you allowed it to. But once there is a directory that
does exist on both PCs under the same name, Office'n'Home will
"have a closer look" at that directory's contents.
When it finds a file that does not exist on the other PC,
Office'n'Home prompts you whether this file should be deleted or
not. NEVER will it delete anything without your explicit allowance
to do so. From my own experience with oah, I have found that this
confirmation is so important that I have removed a former "don't
ask, just kill" option from the program, and nobody will ever
convince me to re-install it!
Now there are two possibilities: You may either agree with the
deletion (in case the file is undeletable, Office'n'Home will
notify you), or you may prefer to leave it alone, and Office'n'Home
will offer you to mark this file as "updated". Why updated ? Well,
for synchronization's sake. Remember: We want to be sure that the
directories we want to synchronize ARE INDEED synchronized, which
means that there have to be exactly the same file names! Not a
single one more, not a single one less. So if you refuse to delete
a file that does not exist on the other PC, then you are bringing
the two PCs out of synchronization! To compensate for that,
Office'n'Home wants to make sure that this file will be included in
your next incremental bakup (all updated files will), and every-
thing will be in order again.
By the way--you have certainly realized that in the former para-
graph I was saying "the same file names"; this is not necessarily
the same as "the same files". An example: Assume you have told
Office'n'Home to synchronize both PC's C: drives. You have a file
C:\TXT\A.TXT on the office PC, which is 6 bytes long and contains
the text "Banana". You also have a file C:\TXT\A.TXT on your home
PC, but this one is three bytes long and contains "JAM". Assume
further that there are no other files in that directory on either
PC. Question: Would Office'n'Home consider these directories
synchronized? Answer: Yes ! Everything else could be fatal. Fatal ?
Well, I leave it to you to see that. Tip: Just think of each PC's
CONFIG.SYS...
Pass 1 (synchronization) will not take place the very first time
you are running oah, because it is not yet known which files are on
the other PC, and which are not. You will be notified accordingly.
Pass 2 is a read-only pass. The drives and directories on this PC
are scanned for file names (except drives, directories or files you
have told Office'n'Home to skip); these names become stored in
OFCNHOM.EXE itself. Office'n'Home manages this by filling itself
with file names in RAM, then copying itself to a temporary file,
then deleting itself from disk, and finally renaming the temporary
file to OFCNHOM.EXE.
DOS gurus call this behavior "self-patching" and most of them don't
consider it good manner (to which I generally agree). However, this
program does not "patch" its code (it does not change the way it
works). Instead, it just fills a dedicated data area in its body.
This has two big advantages over a separate data file. First, the
program needs nothing besides itself. Second, DOS will automatical-
ly mark it as "updated" by setting the Archive Bit, so your backup
program will include it with the next incremental backup. Self-
modifying has the two disadvantages, however, that Office'n'Home
cannot be run from a read-only device, and in case you are using an
anti-virus utility, you have to tell it that changes in OFCNHOM.EXE
are nothing to worry about.
While pass 2 will be performed immediately after pass 1 by default,
this does not have to be so. You can instruct Office'n'Home to run
only one pass of choice at a time. For example, it is a good idea
to have two batch files, like these:
- One batch file (say, FIRST.BAT) gets started every morning to
synchronize this PC with the other PC. It does so by first
running CP Backup to restore all files that have been added or
updated on the other PC, and then running pass 1 of Office'n'-
Home to take care for the deleted and renamed files.
- The second batch file (say, LAST.BAT) is being run in the
afternoon, just before you switch off the machine, to prepare
for the synchronization of the other PC. This batch file first
runs pass 2 of oah, and then starts CP Backup to do an incre-
mental backup. This diskette will be read by the other PC's
FIRST.BAT, and so forth.
I will give you examples of how FIRST.BAT and LAST.BAT may look
like in one of the following chapters.
Now that you have a good idea of what Office'n'Home is good for,
and how it works, let's have a look at how the program is actually
being called and the options available.
Office'n'Home's Syntax: How to start the program and how
to set its parameters
Let us start with an example. For this example, we will assume that
Office'n'Home is installed in directory C:\UTI (of course, any
other location is just as fine, as long as you have the privileges
to write and to delete files in that directory. Please revert to
the previous chapters for an explanation why this is necessary).
As I have already explained, you should be at a "plain vanilla" DOS
prompt to start oah; be careful NOT to call it when Windows, OS/2,
or any other multitasking environment is running!
The directory where OFCNHOM.EXE is located must be the current
directory, or the DOS PATH must point to it, or you must call it
using a fully qualified name (if you don't know what a "fully
qualified name" is, or what the PATH is, you ought to read the
appropriate chapters in your DOS manual first).
Now have a look at the following line (but DO NOT yet press any
key, please!):
C:\UTI\OFCNHOM.EXE c: d:\wpwin*\*.* /x *.pvt /n1
I think you have already correctly guessed what this means, but
let's have a closer look at all the components anyway:
C:\UTI\OFCNHOM.EXE This is the program name. In this instance, we
are giving DOS the fully qualified name. Of
course, this would not be necessary if C:\UTI
were our current directory or if C:\UTI were
included in the PATH.
c: This is the first "parameter" we're handing
over to oah. It tells the program that we want
it to include all files on the C: drive, in
all directories and sub-directories.
d:\wpwin*\*.* The second parameter tells Office'n'Home that
we want to include all files from drive D:,
from all directories whose names begin with
WPWIN, and their subdirectories. As you see,
Office'n'Home allows for wildcards in directo-
ry names (and by the way, in drive names,
too).
/x The third parameter starts with a forward
slash, so it is called a "switch". The X
switch tells Office'n'Home that the list of
files to be included has ended, and that the
list of files to be eXcluded follows.
*.pvt The fourth parameter, *.PVT, tells
Office'n'Home to not process files whose
extension is PVT, wherever they may be locat-
ed.
/n1 The fifth and last parameter is yet another
switch. It stands for "No pass 1", and means -
-you guessed it-- that pass number 1 (the
synchronization pass) must not be performed.
For an explanation of pass 1 and pass 2,
please revert to the previous chapter.
Got the idea already ? Fine. Just a few more remarks before we will
construct one more example:
- As is true for most DOS utilities, Office'n'Home is not case
sensitive. For example, it does not matter if you specify the
X switch as /x or /X. However, it IS important that you use
the forward slash to announce it; a minus sign (-) will not
work.
- Be sure to leave at least one space between any two adjacent
parameters.
- As has already been mentioned, wildcards (? and *, as usual in
DOS) are okay in drive letters, directory names, file names,
and file extensions. For each of these, the default value is
"*". For example, MYFILE*.* is interpreted as ?:*\MYFILE.*,
meaning "Have a look at every drive from A: to Z:, and at
every directory and subdirectory you may find, and process any
file whose name starts with MYFILE."
- Office'n'Home uses a "smart scan" algorithm when looking at
drives and directories. This means that it will not touch a
drive or directory if it were useless to search something of
interest there. In the example discussed above, Office'n'Home
would not read another drive besides C: and D:.
- If you exclude a directory (for example, D:\TMP), you automat-
ically also exclude all its subdirectories (D:\TMP\SUB1,
D:\TMP\SUB1\SUB11, D:\TMP\SUB2,...). When you include a direc-
tory (for example, D:\OKAY), you do NOT automatically include
its subdirectories. You have to explicitly allow subdirectory
inclusion with proper wildcard usage (D:\OKAY\*).
All right. Now let us construct an example. Imagine you wanted to
synchronize all spreadsheet (*.WKS) and all document (*.DOC) files
found on any drive except the diskette drives. My suggestion is the
following (your solution may be different):
OFCNHOM *.wks *.doc /x a: b:
Straightforward so far, isn't it? But wait--why didn't we have to
exclude the A: and B: drives in the former example ? Well, due to
oah's "smart scan", this was not necessary, because all the files
of interest had to be on either the C:, or the D: drive (there was
no other possibility). But in the latter example, the explicit
exclusion is very well necessary (and I think the reason is plain
to see).
Now let's finally consider the general syntax of oah:
[full path]OFCNHOM {filename} [/x {filename}] [/n1]
[/n2] [/?]
Something enclosed in square braces ([]) means that this parameter
is optional. As you can see, there is not a single mandatory
parameter for oah. If you call it with no parameter at all, it will
display a short help text and terminate. Do not type the square
braces themselves.
Something enclosed in curly braces ({}) means that it may occur
zero to 16 times. In other words: both the include files list, and
the exclude files list may be empty, or contain up to 16 entries.
Do not type the curly braces themselves.
The switches /n1, /n2, and /x have already been introduced in the
previous chapter. The only parameter not yet mentioned (/?) was in-
cluded for DOS compatibility only; it will tell Office'n'Home to
display a short help text and terminate.
Be not afraid to give wrong input to oah. If you enter an invalid
parameter, Office'n'Home will behave as if the /? parameter was
given; in other words: It will display a help screen and terminate.
If, on the other hand, everything was syntactically correct, it
will display in detail what it is going to do, and it will ask you
to confirm this display.
But what will Office'n'Home prompt you once it thinks it has found
a file to delete ? Look at this:
C:\WPDOS60\DOCS
OLDFILE.DOC <-- this file is...
Normal (...)
Delete it ? (y=yes, else no):
The first and second lines give us the full path name, so we know
exactly which file Office'n'Home means. Next, Office'n'Home can
display one or more of the following (where the actual wording may
vary from version to version):
Normal (neither changed, nor ready-only, etc.):
This file has not recently been changed, nor is it a new
one. This is the normal case, under which it is pretty
safe to let Office'n'Home delete it.
Updated or changed
This will be prompted if Office'n'Home finds the Archive
Bit set. It is up to you to decide if you need this file
any longer, or not. However, this should not be too much
of a problem for you, because if you refuse to delete it,
it will automatically be included in your next incremen-
tal backup.
Hidden
This is a file of whose existence you might not have been
aware at all. If you should delete it or not depends very
much of the application that created it, and please
understand that it is impossible for me to suggest what
to do. As a rule of thumb, you should NOT delete a hidden
file IF it is also a read-only and/or system file (see
below).
Read-Only
This is a file that was flagged by an application to be
undeletable. Office'n'Home can, however, delete it
anyway, if you allow it to. Please see above under "Hid-
den" for my suggestions.
System
This file is one that is of great importance for DOS. I
strongly recommend you to NOT delete it. I further recom-
mend you NOT to let Office'n'Home flag this file as
"changed", since transferring this file can be harmful to
the other PC. Of course, if you are sure that it IS safe
to delete a certain system file, Office'n'Home is able to
do that for you.
Younger than OFCNHOM.EXE
Well, this is a case that simply cannot happen if you're
using Office'n'Home regularly and correctly on both PCs.
However, me and you are only humans, and we can forget to
do something from time to time. When Office'n'Home
displays this message, it has found a file that was
created AFTER OFCNHOM.EXE. In other words: your current
copy of OFCNHOM.EXE is not up-to-date, because for exam-
ple, you remembered to restore it to this PC, but you
forgot to run it in time. However, if you are sure you
don't need this file any longer, it is safe to delete it,
since a new copy of OFCNHOM.EXE will be prepared prior to
your next incremental backup.
While we're talking about prompts--look at these:
D:\PRIVATE <-- Found on this PC only. Skipped.
D:\PRIVATE\CORR <-- On this PC only. Skipped.
D:\PRIVATE\FINANCE <-- On this PC only. Skipped.
Do you remember that I've told you (in the chapter "How
Office'n'Home works") that Office'n'Home will touch ONLY directo-
ries that exist on BOTH PC's ? Well, here's the proof. While
considering the directories on this PC's D: drive, Office'n'Home
has found the directory D:\PRIVATE, which does not exist on the
other PC. Consequently, it was skipped, and its two subdirectories
CORR and FINANCE were skipped, too.
One could argue here that it would be sufficient to tell the user
that D:\PRIVATE was skipped, because this automatically means that
all subdirectories were skipped as well. But from experience with
the program, I find "redundant" information like this quite
useful ! It gives me a clue that I might have removed an entire
subdirectory on the other PC, and remembers me to remove it on this
PC, too.
Depending on whether Office'n'Home was able to complete its job
normally or not (because you cancelled it by pressing ESC, for
example), it will set the DOS ERRORLEVEL value accordingly upon
exit. In case you're running Office'n'Home from a batch file, you
can use the DOS command IF ERRORLEVEL to react accordingly. The
error levels currently defined are:
0 (Number zero): Normal execution. No problem to report.
1 (Number one): Office'n'Home did either not start at all (due
to the /? parameter, which only displays a help screen, for
example), or it was cancelled due to a user interrupt (ESC key
pressed) or some non-fatal error condition (undefined parame-
ter, etc.).
2 (number two): Office'n'Home experienced severe problems with
the operation system and quit immediately to prevent your disk
from irrecoverable data loss.
Remember that under DOS, any errorlevel n includes all lower
errorlevels (n-1), (n-2) etc., so you must test higher levels
first. Look at this sample batch file excerpt:
OFCNHOM (any parameters)
IF ERRORLEVEL 2 GOTO problem
IF ERRORLEVEL 1 GOTO halted
REM ERRORLEVEL 0 is true. Everything's fine.
All right. you are now allowed and encouraged to experiment a
little with Office'n'Home (you did NOT try to do that any earlier,
did you!?).
How to set up your Backup Software
As already mentioned, Office'n'Home works closely together with
your backup software. The former takes care of the files deleted or
renamed, while the latter has to handle the files updated or creat-
ed. Now that it is clear how to use oah, we will consider what has
to be taken care of for the backup program.
The following examples and suggestions refer to Central Point
Backup V8 for DOS ("CPB") in Advanced Mode (assuming that you are
an advanced user). In case you have another backup software, it
should be easy for you to apply everything accordingly.
Start CPB as you normally would. Make sure the backup method is set
to "separate incremental", because we want the program to save only
changed or freshly created files, and we want it to do that
independent of any previous full backup.
Turn "Overwrite Warning" on. We will not need it for backup
purposes, but it is very important during a restore (because we
MUST NOT overwrite any file that already exists on this computer
UNLESS the backed up file is newer).
If you do not want to save all changes from all drives and
directories, specify which ones to include under Options |
Selection options | Include/Exclude files. I recommend you to
include/exclude the same files in both CPB and oah.
All other backup/restore options (for example, "Save history") are
not of interest in this context, and you can leave them as they
are, or change them at will.
Write this new CPB setup to a setup file named OFCNHOM. Give it a
meaningful description, and accept CPB's defaults for everything
else on the Save As screen. That's all!
Three working batch file examples
Now that we have all the pieces, let's build the puzzle! You
certainly remember my suggestion to have a "morning" batch file
(FIRST.BAT), and an "afternoon" counterpart (LAST.BAT). You will
have to install these batch files on both computers. If you would
like to use them, you need not type them in, since they have been
part of your download.
The following is FIRST.BAT:
CLS
ECHO OFF
ECHO Restoring all files that have been updated or created
ECHO on the other computer...
ECHO When Backup asks you if it should overwrite a file,
ECHO remember to reply with
ECHO "overwrite with (N)ewer file only", and
ECHO "(R)epeat for all later files"!
PAUSE
REM Switch to the directory where CPBACKUP is found, and run it
C:
CD \CPB
CPBACKUP
ECHO Now synchronizing this computer with the other one...
REM Switch to the directory where Office'n'Home is found,
REM and run it (pass 1 only)
C:
CD \UTILS
OFCNHOM c: d:\work /n1
IF ERRORLEVEL 1 goto syncerr
ECHO Finished. Remember to call LAST.BAT
ECHO before switching off the machine!
GOTO done
:syncerr
ECHO WARNING: Office'n'Home did not terminate successfully,
ECHO PCs may not be synchronized
:done
The following is LAST.BAT:
CLS
ECHO OFF
ECHO Now searching for drive, directory, and file names...
REM Switch to the directory where Office'n'Home is found,
REM and run it (pass 2 only)
C:
CD \UTILS
OFCNHOM c: d:\work /n2
REM Pass 2 only, expecting normal execution.
REM
ECHO Preparing to save all updated and/or created files.
ECHO Have enough diskettes handy. Select File|Load Setup|
ECHO load OFCNHOM at first.
ECHO Then choose Start Backup. When finished, exit the program.
PAUSE
REM Switch to the directory where CPBACKUP is found, and run it
C:
CD \CPB
CPBACKUP
ECHO Finished. You may now switch off this machine.
ECHO Remember to run FIRST.BAT on the other computer
ECHO after start-up!
Finally, here is a third batch file, SYNCPCS.BAT. It is the one
that I have been using for about a year to synchronize my PC's
entire C: drives. It combines the functionality of FIRST.BAT and
LAST.BAT, depending on the replies you're giving to its prompts.
The prompting is done using MS-DOS 6's CHOICE command (please have
a look at your DOS manual for an explanation), but in case you do
not have DOS 6, any other similar tool will do just as well.
This batch file also introduces my way to keep a copy of each PC's
CONFIG.SYS and AUTOEXEC.BAT files on ALL machines, yet avoiding to
accidentally overwrite or delete either one. There is a command
"SET PC=nnn" in each PC's AUTOEXEC, which assigns a unique "PC ID
number" on start-up. For example, on my home PC, this line reads
"SET PC=001", while on my office PC, it reads "SET PC=002". This
makes it easy for my batch files to decide which PC (i.e., which
environment) they're actually running on.
The following is SYNCPCS.BAT:
@echo off
cls
echo Synchronizing PCs...
REM Ask the user if we need to run oah's pass 2
REM (the following is ONE LINE in the batch file!)
c:\dos\choice /c:yn /t:y,10 /n "Are you going to do a backup ?
[Y,n]: "
if errorlevel 2 goto runpcb
c:\uti\ofcnhom /n1 c:*.*
:runpcb
REM Make sure a copy of CONFIG and AUTOEXEC will be saved...
copy c:\config.sys c:\config.%pc%>nul
copy c:\autoexec.bat c:\autoexec.%pc%>nul
REM ...but not the actual files, to avoid overwriting the other
PC's configuration.
REM (Setting off the "Archive" bits will tell CPB that these
files have NOT changed.)
c:\dos\attrib -a c:\config.sys
c:\dos\attrib -a c:\autoexec.bat
REM Now run PC Backup (the /PS2 param only resets the mouse):
cpbackup /ps2
:sync
REM The following is ONE LINE in the batch file!
c:\dos\choice /c:yn /t:y,10 /n "Did you restore anything ?
[Y,n]: "
if errorlevel 2 goto exit
REM User did a restore - Now run oah's pass 1:
c:\uti\ofcnhom /n2 c:*.*
:done
As you see, I trust so much in both CP Backup and oah, that I am
NOT testing for ERRORLEVELs. I recommend very much to you not to be
as lazy as I am, and to add the proper IFs yourself. And again,
knowing that I am repeating myself: For heaven's sake, have a good
UNDELETE utility installed (such as Delete Sentry) at all times and
on all PCs!! This will make your life as a PC user much safer,
regardless of whether you're using Office'n'Home or not.
Synchronizing different drives
So far, I have only explained you how to synchronize directories on
equally named drives (for example, C:\BAT on the home PC against
C:\BAT on the office PC or vice versa). While this is what I am
actually doing most of the time, there are situations where it is
impossible to grant that all drives exist on all PCs. For example,
I sometimes want to synchronize my home PC's D: drive (which is the
second hard disk drive) against the \INATIAM directory on my office
PC's V: drive (which is in reality my part of the LAN Server's
disk. Oh, and INATIAM stands for: It's not a trick, it's a Merony.
Blush.)
No problem. Office'n'Home supports both the DOS SUBST command, and
the Novell Netware MAP utility. In the following text, I'll assume
that you are familiar with the SUBST command; if not, please refer
to your DOS manual now and do some experiments with SUBST, until
you feel comfortable with it. In case a Novell network is involved
at your site, too, then you must also have an understanding of (and
access to) MAP.EXE. Sorry, I do not know any other network
operating system besides Novell, but I am sure that whichever
network you may use, there sure exists something that lets you
assign a local drive letter to a networked directory.
We are going to use a "buffer" drive for our purpose. First, we
must find a "local" drive letter which is not in use on any PC. I
am using K: for this purpose, and I will use it for the following
examples, but of course any other unused letter will do just as
well. Do not forget to have a look at both PC's CONFIG.SYS files,
to verify that LASTDRIVE makes that letter available (your DOS
manual will tell you more about LASTDRIVE if necessary).
The rest is obvious. While I do not have to take care for the C:
drives (because C: exists on both PCs), I have to remap V:\INATIAM
to K: before running SYNC.BAT on the office PC, like this:
MAP K:=V:\INATIAM
Or, if I were working on my home PC, I had to do issue a
SUBST K: D:
Of course, it is a good idea to include commands like these in the
respective AUTOEXECs. If you prefer not to establish permanent
drive mappings, it is okay to use them only temporarily for
synchronizing purposes; but then again, remember to un-do them once
you don't need them any longer:
MAP DEL K: ,or
SUBST K: /D ,respectively.
A day in the life of Mr. Sampleuser
I will now demonstrate how synchronizing two PCs actually works.
Let's watch the files that are residing in the C:\WPWIN\DOCS
directory of Mr. Whatheheck I.S. Sampleuser's home and office PCs.
This is of course not the only directory that he wants to synchro-
nize. Alas, it is the only one he would let us have a look at, and
that's sufficient for this chapter's purposes anyway.
On February 2 (who says everything must start on January 1 ?), the
documents on both PCs are perfectly synchronized:
Home Office
DRAFT.DOC DRAFT.DOC
IOM.DOC IOM.DOC
PHONES.LST PHONES.LST
It's 7am, and Mr. Sampleuser starts working at the office. First,
he adds a new phone number to his phone list (PHONES.LST). At 9am,
his boss drops in to give him the official okay for the new project
schedules (DRAFT.DOC). Accordingly, Mr. Sampleuser renames
DRAFT.DOC to SCHED1.DOC and prints the copies needed by the
respective departments. At 10am, he writes, sends, and saves a fax
under the name REQUEST.FAX.
Now the situation looks like this:
Home Office
DRAFT.DOC SCHED1.DOC (A)
IOM.DOC IOM.DOC
PHONES.LST PHONES.LST (A)
REQUEST.FAX (A)
...where (A) marks files that have changed, or have been created,
since the most recent incremental backup.
Mr. Sampleuser has a half day off, so at 12am, he exits Windows (he
can afford using Windows because his work is not time critical),
and runs LAST.BAT (see the "Sample Batch files" chapter for an
introduction of FIRST.BAT and LAST.BAT).
What happens first, is that Office'n'Home stores the four names
listed above, marking itself as "changed" immediately afterwards.
Next, PC Backup does an incremental backup, which includes all
changed files from all directories that Mr. Sampleuser wants to
synchronize. This means that from out sample directory,
SCHED1.DOC, PHONES.LST, and REQUEST.FAX are getting stored on
diskette. And most important: Since Mr. Sampleuser took care to
include his utilities directory in the backup, OFCNHOM.EXE is being
saved, too.
Okay. Mr. Sampleuser is a quite normal PC user. Once arrived at
home, he gives a short kiss to his wife and children, and storms
into the cellar to fire up his private PC. After boot-up has
completed, he inserts the diskette he prepared at the office, and
starts FIRST.BAT.
The first thing FIRST.BAT does is to call PC Backup to restore all
files from diskette. Of course, Mr. Sampleuser is careful to
overwrite files ONLY if the copy on diskette is newer. Let's take
a snapshot here:
Home Office
DRAFT.DOC SCHED1.DOC
IOM.DOC IOM.DOC
PHONES.LST (A) PHONES.LST
REQUEST.FAX (A) REQUEST.FAX
SCHED1.DOC (A)
Note that on the office PC, the (A)'s have disappeared. This proves
that a backup had taken place.
Now Office'n'Home gets into play. Almost instantly, it displays the
following prompt:
C:\WPWIN\DOCS
DRAFT.DOC <-- This file is...
Normal (...)
Delete it ? (y=yes, else no):
Mr. Sampleuser replies "y" to get rid of this file, and voila, both
PCs are synchronized again. He jots down some marvelous ideas for
tomorrow's work into a file IDEAS.DOC, and remembers to run
LAST.BAT before switching off the machine. Snapshot:
Home Office
SCHED1.DOC (A) SCHED1.DOC
IOM.DOC IOM.DOC
PHONES.LST (A) PHONES.LST
REQUEST.FAX (A) REQUEST.FAX
IDEAS.DOC (A)
This time, you should be able to tell which files will be saved to
diskette, and scanned into OFCNHOM.EXE, so I won't bother you be
repeating all that stuff.
Can we gues what tomorrow's FIRST.BAT on the office PC will do ?
Sure we can. First, it will restore all files that are newer on
diskette than on disk. In other words, only IDEAS.DOC will be
restored. Second, Office'n'Home will find nothing to delete (at
least not in this directory). So we can already predict tomorrow's
documents:
Home Office
SCHED1.DOC SCHED1.DOC
IOM.DOC IOM.DOC
PHONES.LST PHONES.LST
REQUEST.FAX REQUEST.FAX
IDEAS.DOC IDEAS.DOC (A)
And Mr. Sampleuser was happily synchronizing his files ever
after...
What if...?
Since this is the very first time I am releasing Office'n'Home to
the public, I have not yet received any questions and/or concerns.
But as far as I can consider it, these are the questions you are
most likely to ask (and the respective answers, of course):
Q: What if I had two or more consequtive sessions on PC #1 (I
mean, I did not have the time to work on PC #2) ?
A: No problem at all. From the view of PC #2, your many PC #1
sessions look like one. Just prepare for synchronizing as soon
as you're going to work on PC #2. In case you do not know in
advance when you'll be working at PC#2, be prepared for it
every day, but remember to use another set of backup diskettes
each time. Once you are ready to begin on PC #2, restore all
diskettes in chronological order, and run oah. That's all.
Q: What if I started working on PC #1, having forgotten to first
synchronize it with #2?
A: Again: No problem! Simply run Office'n'Home now. Be careful
with the files that Office'n'Home will flag as "newer than
OFCNHOM.EXE". A general suggestion cannot be given, but if
you're in doubt, better leave these files in place.
Q: Sometimes Office'n'Home asks me if I want to delete a file
from a directory which I did not include. How come ?
A: First: You DID include that directory! Have a closer look at
your Office'n'Home command line to convince yourself. Particu-
larly, look at the wild cards... Second: To get out of that
directory for the moment, do not let Office'n'Home delete the
file, and do not let it mark the file as updated. The program
will then ask you if it should leave this directory alone.
Answer "y" (yes).
Q: What if I had accidentally allowed Office'n'Home to delete a
file ?
A: Don't panic! After all, you have followed my advice to have an
UNDELETE utility installed, haven't you? Okay--write down the
file's name as long as you still see it on the screen, and
remember to undelete it as soon as possible. If you wish, you
can now run Office'n'Home once again to mark this file as
updated.
Q: I am using another program than PC Backup for my backup
purposes. Is that okay with Office'n'Home ?
A: Sure it is. Even plain XCOPY (with the /A parameter) will do.
Just be aware that your backup program will not be able to
read the sample OFCNHOM.SET file (a PC Backup-specific
configuration file), and you will have to change the sample
batch files accordingly (FIRST.BAT and LAST.BAT).
Q: I am not usually doing "incremental" backups to diskette.
Instead, I use to make full or differential backups to tape.
So what ?
A: Again, absolutely no problem. I was only suggesting separate
incremental backups for your convenience, because they usually
take the least amount of time. Any kind of backup will do, as
long as it will at least include all changed or created files
from all directories that are scanned by Office'n'Home. And of
course, OFCNHOM.EXE must also be backed up.
Q: I have been running FIRST.BAT (or LAST.BAT), and it says that
it cannot find CPBACKUP (or OFCNHOM.EXE). What's up ?
A: Well, when you installed PC Backup (or oah, respectively), you
had simply chosen another directory to hold the program than
I had. It's just a matter of taste. All you have to do is to
edit the batch file(s) to suit your directory names, and re-
run it.
Q: I was running LAST.BAT at the office, without problems. Howev-
er, soon after it was finished, my boss came in and told me to
write yet another report for him (TEXT5.DOC). After that, I
know I could have simply re-run LAST.BAT (using another
diskette), but I did not have the time to do that. Any
comments ?
A: Since you were not able to re-run PC Backup after you wrote
that last report, it will not be restored to your home PC
today (because it was not included in the backup). And since
Office'n'Home did not yet know about TEXT5.DOC, it will
synchronize your home PC to the office PC as it was at the
point in time when you ran LAST.BAT. If you do not immediately
need that report at home, don't worry; it will be automati-
cally included the next time you run LAST.BAT on the office
PC. If you DO need it, though, I am afraid you're out of luck,
and you must be patient until tomorrow.
Q: I have been running the sample batch file SYNCPCS.BAT, but I
get the error message "bad command or file name". What's up ?
A: First, SYNCPCS needs DOS 6, because it makes use of the new
CHOICE command. Second, if you DO have DOS 6, remember that a
sample is a sample. Your programs (such as PC Backup) may be
stored in a different directory than I assumed when I wrote
SYNCPCS:BAT. Simply edit the batch file to suit your individu-
al file locations, then re-run it.
Q: Are there any files which I should not let Office'n'Home
delete under all circumstances ?
A: I recommend to never delete DOS's system files (like IO.SYS,
or IBMBIO.COM, repectively). Further, you should not delete
AUTOEXEC.BAT, and CONFIG.SYS. It is very unlikely that
Office'n'Home will ever ask you if it should delete one of
those, though. There may be other files which you should leave
alone, too, but that depends very much on what PC environment
you're using (for example, it is not a good idea to delete
Window's "permanent swap file"). As a rule of thumb, never
delete a file if Office'n'Home tells you that it is a system
file (you'd better consider why this file does not exist
anymore on the other PC!).
Q: Can I synchronize more than two PCs?
A: Sure you can. Let's assume that you have, say, three PCs,
named A, B, and C. All you have to do is to synchronize B with
A first, C with B second, and A with C third. You don't even
have to be concerned of all three PC's at all times. For
example, just synchronize A and B every day, and C with A once
a week. Everything will be fine! If it is not immediately
clear to you why this works, I recommend you to jot down a
scenario similar to "Mr. Sampleuser" on a scratch paper; this
time not with 2, but with n machines.
(Q&A section to be continued - your ideas are requested!)
A definition of Shareware
I promised to give you an exact definition of "Shareware".
Hopefully, this will be exact enough for you:
Shareware distribution gives users a chance to try software
before buying it. If you try a Shareware program and continue
using it, you are expected to register. Copyright laws apply to
both Shareware and commercial software,and the copyright holder
retains all rights, with a few specific exceptions as stated
below. Shareware authors are accomplished programmers, just like
commercial authors, and the programs are of comparable quality.
(In both cases, there are good programs and bad ones!) The main
difference is in the method of distribution. The author
specifically grants the right to copy and distribute the
software, either to all and sundry or to a specific group. For
example, some authors require written permission before a
commercial disk vendor may copy their Shareware.
Shareware is a distribution method, not a type of software. You
should find software that suits your needs and pocketbook,
whether it's commercial or Shareware. The Shareware system makes
fitting your needs easier, because you can try before you buy.
And because the overhead is low, prices are low also. Shareware
has the ultimate money-back guarantee -- if you don't use the
product, you don't pay for it.
How to register, and where to find help
A Office'n'Home registration licenses you to use the product on a
regular basis. Individual registrations for Office'n'Home cost $10.
Volume discounts and/or site licenses are available upon request.
At the moment of this writing, I am distributing exclusively
through CompuServe ("CIS"), so the only way to register is through
CIS. It is also currently the only way to get help.
Registering is easy. Just GO SWREG, and when asked which program to
register to, answer 123456. That■s all! A single regular registra-
tion fee of $10 will be automatically forewarded to me, and you
will be charged through your CIS-related credit card.
Getting help is also easy. Just drop me a note; I am "Michael Meron
100270,270". I will reply asap. (Oh yes, I know there are certain
guys who spew test messages, just to see if some CIS account is
really alive and kicking. All right, go ahead, I cannot stop you
either. But remember that you keep me away from responding to
serious mail!)
Disclaimer
I do everything to make sure that Office'n'Home (among others) is
well-behaved and does exactly what it is intended to do. However,
users of Office'n'Home must accept this disclaimer of warranty:
"Office'n'Home is supplied as is. The author disclaims all
warranties, expressed or implied, including, without limitation,the
warranties of merchantability and of fitness for any purpose.The
author assumes no liability for damages, direct or consequential,
which may result from the use of Office'n'Home."
Trademarks and Copyrights
Office'n'Home and OFCNHOM.EXE are trademarks of Michael Meron EDV-
Beratung, Hamburg, Germany. MS-DOS and Windows are registered
trademarks of Microsoft Corporation. PC-DOS is a registered
trademark of IBM Corporation. PC Tools and PC Backup are registered
trademarks of Central Pint Software, Inc. The Norton Backup is a
registered trademark of Symantec Corp. Fastback is a registered
trademark of Fifth Generation Systems, Inc.
All other brand names are trademarks or registered trademarks of
their respective owners.