;
                                    CPD.COM                                   

             Size (recs) CRC   Version    Author/Latest Issue      Disk
               4k (32)   F156  1.50       Gene Pizzetta 1/92       Z3COM3

  1- Syntax/Options  2- Configuration  3- Error Messages  4- Notes            


   CPD is A ZCPR3 utility to compare two directories and indicate which  files
exist in both  directories and  which  exist only in the first directory.  The
error flag is set if both directories don't match.  It also allows setting the
archive attribute on those files which exist in both directories, facilitating
copying those that do not  (although Rob Friefeld's  SCOPY  is probably better
for that purpose).

   Version 1.0 (8/4/91) by Gene Pizzetta.   The  idea (but not the  code) came
from CDIR 2.0 by Robert Wilcox and Richard Brewster.  
:1
    Syntax   CPD {dir:}{afn} {dir:} {{/}options}

   If no DU or DIR is given,  the current default is assumed.   If no filename
is given, all files  ("*.*") is assumed.   To make the the first directory the
current  directory,  only a colon or  a period need  be  entered for the first
parameter.

   If no option is given, all matching non-system files in the first directory
are displayed with files  marked  which  also  exist  in the second directory.
The duplicated files will be marked with both an  asterisk following the file-
name and by dim or reverse video  (the standout string installed in the TCAP).
The asterisk allows visible markings in printer output or for  TCAP's  with no
standout string installed.

   CPD can be aborted at any time with ^C.  If file output is in progress, the
file will be properly closed, but it will not be erased.
 Options - 1/3   

   A slash is not required if the  option list is the  third  parameter on the
command line.

     B    Display only files that exist in both directories, that 
          is, display only marked files.  Since option N is 
          incompatible, choosing this option cancels option N.

     N    Display only files in the first directory that are not
          in (that is, missing from) the second directory.  Since
          option B is incompatible, choosing this option cancels
          option B.

     A    Set the archive attribute of matching files in the 
          first directory that also exist in the second directory 
          (marked files).  This option facilitates copying the 
          missing files to the second directory with a copy
          program that recognizes archived files, such as COPY,
          PIP, ACOPY, etc.  CPD does not remove archive 
          attributes on other files, so they should first be 
          reset with a program such as DA or FA before calling CPD.
 Options - 2/3 

     S    Include system (hidden) files.  By default CPD ignores 
          system files in both directories.

     P    Do not page screen display.  By default CPD waits for a 
          key to be pressed after each screenful of filenames.

     O    Output the matching filenames to a disk file "CPDLIST". 
          Any existing file with the same is name is erased 
          without warning.  The resulting list file has one 
          filename per line in upper-case.  It is written in the 
          "target" directory (the first one given on the command 
          line), but CPD can be configured to write the file to 
          the currently logged directory instead.

     D    Include the drive/user specification with each filename 
          in CPDLIST.

     L    Echo the screen display to the printer.  Printer output 
          is continuous (not paged).  This option also suppresses 
          screen paging.
 Options - 3/3 

     F    Send a final form feed to the printer after the display 
          is completed.  This option has no effect unless option 
          L is also active.

     Q    Quiet mode suppresses console output.  Printer and file 
          output are not affected.
:2
 Configuration 

   All options except L and O can be made default modes by using ZCNFG and the
accompanying CPDxx.CFG file.  In that case the command line option will toggle
the option to the non-default mode.   Do not set  both  options  B  and  N  as
defaults.  Take my word for it, you will not like the result.

   CPD can be set to show filenames in upper-case, if you prefer.  Whether the
CPDLIST output file is written to the  currently  logged  directory  or to the
target directory can also be selected.

   In addiion, CPD can be  configured  to  set the error  flag  and invoke the
error handler when it is aborted by a  ^C  from he user.   This will allow the
user to also abort a ZEX or SUB batch operation.

   It is best not to change the name of the configuration file.   Its  special
name assures that ZCNFG will always find the  correct  CFG  file,  even if the
name of CPD has been changed or if more than one version of CPD is online.
:3
 Error Messages 

   CPD sets the program error flag to  255 (0FFh)  if any  files  matching the
file mask in the first  directory do not  also  exist in the second directory.
This feature will allow batch  operations to  take  corrective  action  if two
directories do not match.   Be sure your  routine  checks  for  255,  however,
because the error flag can be set for other reasons.

The error flag is set as follows:
      2 = invalid directory given
      4 = user abort (optional)
     11 = disk or directory full
     12 = out of memory
     16 = duplicate directory entries
     19 = invalid option given
    255 = directories do not match

   For all errors except 255 the error handler is invoked, if one is installed
in your system.
:4
 CPD Notes - 1/2 

   a. Vs 1.5 updates (1/19/91, Gene Pizzetta):
      - OpLFlg was not being initialized, which caused strange things to 
        happen sometimes.

   b. Vs 1.4 updates (1/16/91, Gene Pizzetta):
      - Added D option to include DU specifications with filenames in the 
        CPDLIST output file.  Output filename configurable.  Now uses new 
        ZSLIB listfile output routine that saves enough bytes to keep CPD 
        under 4K.

   c. Vs 1.3 updates (12/30/91, Gene Pizzetta):
      - Bugs fixed:  CPD was writing CPDLIST to second (compared) directory 
        when configured to write to the first (target) directory.  Also, CPD 
        was not stripping high bits when creating CPDLIST.

   d. Vs 1.2 updates (12/27/91, Gene Pizzetta):
      - Option O outputs matching filenames to a disk file in the default or
        target directory (configurable).  
      - Minor corrections to usage screen.  
      - Option Q suppresses console output.
 CPD Notes - 2/2 

      - New error codes for duplicate directory specification (16), out of 
        memory (12), and disk or directory full (11).  

   e. Vs 1.1 updates (12/21/91, Gene Pizzetta):
      - The first version was a bit brain-damaged.  It read only the first 
        directory into memory and accessed the second disk once for each file-
        name.  SLOW!  Now both directories are loaded into memory and CPD 
        works very fast.  
      - Option M (show only files MISSING from second directory) has been 
        changed to N (show only files NOT in second directory), which seems 
        more intuitive to me.  The M option still works, though.  
      - If system files are excluded from the first directory scan, they are 
        also excluded from the scan of the second directory.  
      - CPD now displays eight columns of names if the environment indicates 
        the screen has more than 121 columns.  
      - Between column divider is now configurable for both console/printer.
      - Filenames can be displayed in upper- or lower-case (configurable).  
      - Sets error flag for invalid directory (2), TPA overflow (12), invalid 
        option (19), and for no matching file in second directory (FFh).  
        The error handler is invoked on error, except for no matching file.