CPD Version 1.5 Gene Pizzetta January 19, 1992 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). USAGE: CPD {dir:}{afn} {dir:} {{/}options} If no DU or DIR is given, the current default is assumed. If no filename is given, all files ("*.*") are 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 filename and by dim or reverse video (the standout string installed in your 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: 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 on 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. 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. 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. ERROR FLAG: 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. 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. HISTORY: Version 1.5 -- January 19, 1991 -- Gene Pizzetta OpLFlg was not being initialized, which caused strange things to happen sometimes. Version 1.4 -- January 16, 1991 -- 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. Version 1.3 -- December 30, 1991 -- 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. Version 1.2 -- December 27, 1991 -- Gene Pizzetta Option O outputs matching filenames to a disk file in the default or target directory (configurable). Minor corrections to usage screen. New error codes for duplicate directory specification (16), out of memory (12), and disk or directory full (11). Option Q suppresses console output. Version 1.1 -- December 21, 1991 -- 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 filename. 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. The between column divider is now configurable for both console and 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. Version 1.0 -- August 4, 1991 -- Gene Pizzetta The idea (but not the code) came from CDIR 2.0 by Robert Wilcox and Richard Brewster. This program could be a lot faster if both directories were loaded into memory first, but it does the job. Next time . . . Please report any bugs or make suggestions to: Gene Pizzetta 481 Revere St. Revere, MA 02151 Voice: (617) 284-0891 Newton Centre Z-Node: (617) 965-7259 Ladera Z-Node Central: (213) 670-9465