DIRCOMP.TXT                          1                         Nov 07, 1999

WIN95 AND WINNT NOTICE:  As with most  DOS-based  utilities,  this  program
doesn't  understand  the  weird  subdirectories,  long  filenames,  invalid
characters that  are  possible  under  Windows  95  and  Windows/NT.   Both
operating systems alias long filenames  into  names  like  MYFILE~1.TXT  so
that's what you're going to  see  processed.   Under  some  file  structure
systems in NT, the program may not work at all.

DIRCOMP compares subdirectories and looks for dissimilarities between files
(different sizes or creation dates as well as missing files).  You can have
the  command  copy  files  from  the  first  subdirectory  to  the   output
subdirectory.  In some ways, this is  similar  to  the  XCOPY  and  REPLACE
commands in DOS except there  are  a  number  of  enhancements  which  make
DIRCOMP ideal for network maintenance work.  These features include:

  * You can specify that the command copy only unmatched  files  (something
    that can't be done using XCOPY).
  * You can specify that the command process child subdirectories  as  well
    (something that can't be done using REPLACE).
  * You can delete the files which are in the destination subdirectory  but
    not in the source subdirectory.
  * You can specify up to 10 file exclusion or inclusion specifications.
  * You can also specify up  to  10  subdirectory  exclusion  or  inclusion
    specifications.
  * DIRCOMP produces a  disk  report  called  (by  default)  C:\DIRCOMP.TXT
    showing the dissimilarities.
  * DIRCOMP can move the files instead of copy them,  effectively  allowing
    you to prune and graft directory structures.
  * The date format shown is based on your country setting.
  * Pressing escape stops the program early.

DIRCOMP is typically used in the process of backing up files from one drive
to another.  DIRCOMP allows you to easily copy every file and  get  rid  of
now non-existant files.

Most people who report using DIRCOMP say they use the program  to  maintain
workstations in a networked  environment.   They  take  the  files  from  a
network directory and use them to replace the files on the workstation.

Note that DOS includes a command called REPLACE which will do some  of  the
same things that this utility  does.   The  central  differences  are  that
REPLACE won't delete mismatched files and it doesn't produce  a  report  on
inconsistencies.  REPLACE also doesn't  have  the  ability  to  handle  odd
attributes or deal with  cascading  subdirectories.   REPLACE  *is*  a  lot
quicker though.

WARNING:  Don't try using redirection with this command.


DIRCOMP.TXT                          2                         Nov 07, 1999

The report:

If you have the report option turned on (/F or /Frptfile), the program will
produce a text file comparing the two file specifications and  showing  you
differences and such.  And example of a report:

DIRCOMP begun: 11-27-96 at 14:05:21
Parms: \TEMP \TEMP2 /S /FC:\X3.X /OVERWRITE /CLONE /KILL /ALL

Directory 1: C:\TEMP\ /S
Directory 2: C:\TEMP2\ /S

                                         +--  = copied, x = killed
FileName     Directory 1.................| Directory 2................. Verdict

AUTO.1       11-06-96 14:55:42      1,340                              Miss(2)
AUTOEXEC.1   11-06-96 14:55:42      1,340                              Miss(2)
CONFIG.1     08-19-96 14:57:50        725                              Miss(2)
PHONMAIL.OUT 11-27-96 03:38:22      3,768 11-27-96 03:38:22      3,768   ok
TEST0.BAT    11-27-96 13:53:16        153 11-27-96 13:53:16        153   ok
TEST1.BAT    11-27-96 13:48:44         89 11-27-96 13:48:44         89   ok
TEST2.BAT    11-27-96 13:48:44         81 11-27-96 13:48:44         81   ok
TEST3.BAT    11-27-96 14:05:16         81 11-27-96 14:04:48         88 Newer(1
X.1          11-27-96 13:45:38      2,242                               AttSkip
X1.X         11-27-96 14:01:56      2,346                               AttSkip
X2.X                                     x 11-27-96 14:02:00      2,374 Miss(1)
X3.X                                     x 11-27-96 14:04:52      2,462 Miss(1)

  1\
AUTOEXEC.BAT 11-06-96 14:55:42      1,340 11-06-96 14:55:42      1,340   ok
HIDDEN.TXT   11-06-96 14:55:42      1,340  11-06-96 14:55:42      1,340 AttSkip
READONLY.TXT 11-06-96 14:55:42      1,340  11-06-96 14:55:42      1,340 AttSkip
SYSTEM.TXT   11-06-96 14:55:42      1,340  11-06-96 14:55:42      1,340 AttSkip

  2\
AUTOEXEC.BAT 11-06-96 14:55:42      1,340 11-06-96 14:55:42      1,340   ok

     15           Dir 1: Total files in C:\TEMP\ /S
              12  Dir 2: Total files in C:\TEMP2\ /S
      1        1  Older in dir 2 (Copied)
      0        0  Newer in dir 2 (Copied)
      0        0  File sizes differ (Copied)
      6        6  Identical date/time/size (Copied)
      0        2  Not in dir 1 at all (Deleted)
      3        0  Not in dir 2 at all (Copied)
      5        3  Having excluded attr spec
     10  files copied (10,257 bytes)
      2  files killed (4,836 bytes)

DIRCOMP ended: 11-27-96 at 14:05:24

Note there is a column with "" (square root symbols)  that  indicates  the
file was copied/moved or an "x" to indicate the file was deleted.


DIRCOMP.TXT                          3                         Nov 07, 1999

When are files copied or moved:

DIRCOMP has five  action  parameters  that  are  mutually  exclusive  which
determines which (if any) files get copied or moved:

 /NONE   says to skip everything and just report on the differences.

 /A      says to only copy files to the destination  subdirectory  only  if
         they are not currently there.

 /U      says to only copy files to the destination  subdirectory  if  they
         are newer in the source subdirectory.

 /AU     says to copy files if they  are  either  not  in  the  destination
         subdirectory or they're more recent in the source subdirectory.

 /DIFF   says to copy any files which are different in size, creation date,
         or time as well as any files which  don't  already  exist  in  the
         destination subdirectory at all.

 /CLONE  says to copy everything no matter what.

The following table may help explain this:

File in         File in                               Copy?
Source sub      Destination sub       /NONE /A    /U    /AU  /DIFF  /CLONE

Newer           Older                 no    no    YES   YES  YES    YES
Older           Newer                 no    no    no    no   YES    YES
One size        Another size          no    no    no    no   YES    YES
Present         Missing               no    YES   no    YES  YES    YES
Same            Same                  no    no    no    no   no     YES

Missing         Present               (delete if /KILL set)


Specifying parameters:

Parameters for this program can be set in the  following  ways.   The  last
setting encountered always wins:
  - Read from an *.INI file (see BRUCEINI.TXT file),
  - Through the use of an environmental variable (SET DIRCOMP=whatever), or
  - From the command line (see "Syntax" below)



DIRCOMP.TXT                          4                         Nov 07, 1999

Syntax:

    DIRCOMP directory1 directory2 [ /S ] [ /CREATE ]
      [ /NONE | /A | /U | /AU | /DIFF | /CLONE ] [ /KILL ] [ /MOVE ]
      [ /Xfilespec ]... [ /Nfilespec ]... [ /-Ssubspec ]...
      [ /+Ssubspec ]... [ /ATTR=attribs ] [ /F | /Frptfile | /-F ]
      [ /OVERWRITE | /APPEND | /-OVERWRITE ] [ /ALL ] [ /T=temp_dir ]
      [ /Q ] [ /COLOR=nnn | /MONO ] [ /Iinitfile | /-I ] [ /-ENV ] [ /? ]

where:

"directory1" is the name of the primary (source) subdirectory.  If /NONE is
not in effect, the secondary subdirectory's contents  will  be  changed  to
reflect the ones here.  Note that this is a subdirectory name, not  a  file
specification.  So it's expecting C:\CMA, not  C:\CMA\*.*  .   Having  said
that, the program typically  guesses  what  you  meant  and  fills  in  the
appropriate /Nfilespec parameters for you  but,  to  be  sure,  you  should
specify things explicitly.

"directory2" is the name of the  secondary  subdirectory  which  will  have
files copied to it or deleted from it.

"/S" goes through and processes subdirectories off  of  the  subdirectories
you specified in a cascading manner.  You  can  use  this  option  to  copy
entire directory trees if you want.  Of course you  still  need  a  setting
other than the default /NONE if you want it to actually do anything besides
report on conditions.  "/-S" (the opposite) is initially the default.

"/CREATE" will create directory2 if it doesn't exist already.  Of course it
will not create subdirectories more than one level deep (if you don't  have
a C:\TEST  yet,  don't  bother  specifying  that  you  want  it  to  create
C:\TEST\CASE for you).  "/-CREATE" (the opposite) is initially the default.

"/NONE" specifies that no actual copying or moving  of  files  is  to  take
place.  This is initially the default.  The following  parameters  are  all
mutually exclusive:  /NONE, /A, /U, /AU, /DIFF, and /CLONE.

"/A" adds new files only to the  destination  subdirectory.   If  the  file
exists already in the destination subdirectory, it  will  be  skipped  over
whether it's newer or not.   The  following  parameters  are  all  mutually
exclusive:  /NONE, /A, /U, /AU, /DIFF, and /CLONE.

"/U" says to copy files only if  they  exist  already  in  the  destination
subdirectory and only if the files  in  the  destination  subdirectory  are
older than the ones in the source subdirectory.  The  following  parameters
are all mutually exclusive:  /NONE, /A, /U, /AU, /DIFF, and /CLONE.

"/AU" copies the file if the version in  the  destination  subdirectory  is
either missing or older than the one in the source subdirectory.  Note that
"/UA" is treated the same as  "/AU".   The  following  parameters  are  all
mutually exclusive:  /NONE, /A, /U, /AU, /DIFF, and /CLONE.

"/DIFF" says to copy files from the source subdirectory to the  destination
subdirectory if it either doesn't exist in the destination subdirectory  or
its file date, time, or size is different.  The  following  parameters  are
all mutually exclusive:  /NONE, /A, /U, /AU, /DIFF, and /CLONE.


DIRCOMP.TXT                          5                         Nov 07, 1999

"/CLONE" says to copy all files from directory1 to directory2.  Period. The
following parameters are all  mutually  exclusive:   /NONE,  /A,  /U,  /AU,
/DIFF, and /CLONE.

"/KILL" says to delete any files in directory2 which are not in directory1.
It will also delete any empty subdirectories in  directory2  (whether  they
were empty off directory1 or not).  The program may not be smart enough  to
delete all embedded subdirectories.  (If both \TEST  and  \TEST\LEVEL2  are
empty, \TEST\LEVEL2 will be wiped out but \TEST won't be.) /KILL is ignored
if /NONE is still in effect.  "/-KILL"  (the  opposite)  is  initially  the
default.

"/MOVE" says to move the files instead of copying them.  This deletes  from
directory1 any file that was copied to directory2.  (The deletion  is  done
only if the initial copy succeeded.)  Typically,  the  option  is  used  in
combination with the /CLONE option.  "/-MOVE" (the opposite)  is  initially
the default.

"/Xfilespec" says to exclude certain filespecs from being considered.   You
can specify up to 10 file exclusion parameters but each must have their own
/Xfilespec statement.  For  example,  to  exclude  all  files  with  a  CFG
extension, you could  say  "DIRCOMP  (other  parms)  /X*.CFG".   Note  that
exclusions and inclusions do not apply to subdirectory names.

"/Nfilespec" says to include certain filespecs.  You can specify up  to  10
file  inclusion  parameters  but  each  must  have  their  own   /Nfilespec
statement.  If any /Nfilespec parameter is specified,  any  files  have  to
meet this filespec filter in order to be considered.  For example, to  only
update EXE and COM files, you could  say  "DIRCOMP  (other  parms)  /N*.EXE
/N*.COM".  Defaults to "/N*.*" (no files are not included).  Note  that  if
/Xfilespec and /Nfilespec are both used, files must meet both conditions to
be considered.  For example, under "/X*.B* /N*.BAS",  files  which  have  a
*.BAS file extension will be excluded by the /X*.B* specification  although
they've been included by the /N*.BAS specification.

"/-Ssubspec" says to exclude certain subdirectories from being  considered.
Is typically of use only if /S is also specified.  You can  specify  up  to
ten  subdirectory  exclusion  parameters  but  each  must  have  their  own
/-Ssubspec statement.  Note that the subdirectories  are  excluded  at  the
topmost level.  If your directory structure is:

        VBDOS
          MINE
            OKAY
            TEST
          ONEOFF
            OKAY2
            TEST2

and you specify /-SVBDOS, none of the subdirectories off of \VBDOS will  be
considered.   Similar,  if  you  specify  /-SO*,  the  program  will   skip
\VBDOS\MINE\OKAY  (as  you  might  expect)  but  it   will   also   exclude
\VBDOS\ONEOFF\TEST2 because the exclusion test will keep  anything  in  the
\VBDOS\ONEOFF subdirectory from being considered at all.


DIRCOMP.TXT                          6                         Nov 07, 1999

"/+Ssubspec" says to include certain subdirectories.  Is typically  of  use
only if /S is also specified.  You  can  specify  up  to  ten  subdirectory
inclusion parameters but each must have their own /+Ssubspec statement. See
the notes under the "/Nfilespec" and "/-Ssubspec" parameter discussions for
related considerations.

"/ATTR=attribs" allows you to specify a combination of attributes that  you
want considered.  You can specify  any  combination  of  R  (read-only),  H
(hidden), S (system), or A (archive bit).  Precede  any  character(s)  with
"-" to exclude instead of include.  Unlike with the DOS  DIR  command,  the
inclusions and exclusions are subject to  "OR"  conditions;  /ATTR=HS  will
retrieve any file that is either hidden or a system file or both.  You  can
specify "/ATTR=ALL"  to  specify  that  all  files  are  to  be  processed.
Initially defaults to  /ATTR=-H-S-R  (skip  hidden,  system,  or  read-only
files).

"/F" says to create a report file named  C:\DIRCOMP.TXT  which  shows  what
action  was  taken.    "/F"   is,   in   fact,   the   same   as   entering
"/FC:\DIRCOMP.TXT".  The default is initially to create no  report  at  all
("/-F").

"/Frptfile" provides the name of the report  file  to  create.   Specifying
"/FSCRN:" will send the report to the screen.  You have to include a period
or a colon in the filename for the system to realize  it's  a  filename  or
device (e.g.  "/Frptfile." will work but "/Frptfile" won't).   The  default
is initially to create no report at all ("/-F").

"/-F" skips the creation  of  the  report  file.   This  is  initially  the
default.

"/OVERWRITE" says to overwrite the report file if it's already there.

"/APPEND" says to append to the end of any existing report file.

"/-OVERWRITE" says to abort if the output file exists already.

"/OVERASK" says to prompt if the  output  file  exists  already.   This  is
initially the default.

"/ALL"  says  to  write  all  files   to   the   report   file   (typically
C:\DIRCOMP.TXT), not just the ones that  have  differences.   "/-ALL"  (the
opposite) is initially the default.

"/T=temp_dir" specifies where to write the temporary ISAM  files  that  the
routine needs.  ISAM data bases are used to store and sort the file  names.
ISAM files cannot be created reliably on certain types of drives.  Examples
are "/T=C:" and "/T=C:\TEMP".  If not specified, the routine writes to  the
following in sequence:

  - the value of any TEMP, then TMP, environmental variable
  - C:\TEMP
  - C:\


DIRCOMP.TXT                          7                         Nov 07, 1999

"/Q" turns off the file-by-file status  messages.   It  also  turns  off  a
detailed summary table that shows up after the program is finished.

"/COLOR=nnn" specifies the default color settings to use.  The setting must
must consist of three digits, the first two being the foreground color  and
the last being the background color.  The foreground color should be padded
on the left with a 0 if it is  only  one  digit  in  length.   Defaults  to
"/COLOR=071" (white on blue).

Foreground colors:

        Low intensity           High intensity

        0 = black                8 = dark grey
        1 = blue                 9 = light blue
        2 = green               10 = light green
        3 = cyan                11 = light cyan
        4 = red                 12 = light red
        5 = magenta             13 = light magenta
        6 = brown (or yellow)   14 = light yellow
        7 = white               15 = bright white

Adding 16 to any foreground color will make  the  text  blink.   Note  that
blinking text under Windows only works if your DOS window is  full  screen.
This can be set in the DOS properties or else just say Alt-Enter to make it
full screen.

Background colors can consist of 0 to 7 above.  Bright white on  blue,  for
example, would be "151".  Note that the program automatically adds 8 to the
settings periodically for emphasis so setting the default color to be  high
intensity will actually make the deliberately highlighted text blink.  Very
few sane people actually like blinking  text  so  using  foreground  colors
above 7 is not recommended.

"/MONO" (or "/-COLOR") turns off the colors.  Same thing  as  "/COLOR=070".
This is the default if you're redirecting the output of the  command  (e.g.
"DIRCOMP > NUL:").

"/Iinitfile" says to  read  an  initialization  file  with  the  file  name
"initfile".  The file specification *must* contain a period.  Initfiles are
described in the BRUCEINI.TXT file.  Initially defaults to "/IDIRCOMP.INI".

"/-I" (or "/INULL") says to skip loading the initialization file.

"/ENV" says to look for %var% occurrences in the command line  and  try  to
resolve any apparent environmental variable references.   See  BRUCEINI.TXT
for more information.  This is initially the default.

"/-ENV" says to skip resolving apparent %var% occurrences  in  the  command
line.  Initially defaults to "/ENV".

"/?" or "/HELP" or "HELP" shows you the syntax for the command.

Samples:  DIRCOMP J:\EBBNEW\DATA E:\EBBNEW\DATA /DIFF /KILL /FC:\DATA.EBB
          DIRCOMP E:\EBBNEW\DATA J:\EBBNEW\DATA /A /KILL
          DIRCOMP C:\TC D:\TEMP /CLONE /KILL /ATTR=ALL /S

DIRCOMP.TXT                          8                         Nov 07, 1999

Return codes:

DIRCOMP returns the following ERRORLEVEL codes:

        0 = no problems
      249 = /NONE not specified but nothing copied/moved/deleted
      250 = operation aborted by pressing Escape
      251 = other problems
      253 = no files found in subdirectories
      254 = could not find a decent temporary output subdirectory
      255 = syntax problems, or /? requested


Author:

This program was written by Bruce Guthrie of Wayne Software.   It  is  free
for use and redistribution provided relevant documentation is kept with the
program, no changes are made to the program or documentation, and it is not
bundled with commercial programs or charged  for  separately.   People  who
need to bundle it in for-sale packages must pay a $50 registration  fee  to
"Bruce Guthrie" at the following address.

Additional information about this and other Wayne Software programs can  be
found in the file BRUCE.TXT which should be included in  the  original  ZIP
file.  The recent change  history  for  this  and  the  other  programs  is
provided in the HISTORY.ymm file which should be in the same ZIP file where
"y" is replaced by the last digit of the year and "mm"  is  the  two  digit
month of the release; HISTORY.611 came out in  November  1996.   This  same
naming convention is used in naming the ZIP file (DIRCOymm.ZIP)  that  this
program was included in.

Comments and suggestions can also be sent to:

                Bruce Guthrie
                Wayne Software
                113 Sheffield St.
                Silver Spring, MD 20910

                e-mail: WayneSof@erols.com   fax: (301) 588-8986
                http://www.geocities.com/SiliconValley/Lakes/2414
             or find through http://www.erols.com/waynesof

Please provide an Internet e-mail address on all correspondence.

