DIRCOMP.DOC 1 Revised: 12-22-96 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. * 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. 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. 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. If you're in non-compatible file mode, the program may not work correctly. DIRCOMP.DOC 2 Revised: 12-22-96 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 Newer in dir 1 (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.DOC 3 Revised: 12-22-96 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. /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. /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. /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 /DIFF /A /U /AU /CLONE Newer Older no YES no YES YES YES Older Newer no YES no no no YES One size Another size no YES no no no YES Present Missing no YES YES no 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.DOC file), - Through the use of an environmental variable (SET DIRCOMP=whatever), or - From the command line (see "Syntax" below) DIRCOMP.DOC 4 Revised: 12-22-96 Syntax: DIRCOMP directory1 directory2 [ /S ] [ /CREATE ] [ /NONE | /DIFF | /A | /U | /AU | /CLONE ] [ /KILL ] [ /MOVE ] [ /Xfilespec ]... [ /Nfilespec ]... [ /ATTR=attribs ] [ /F | /Frptfile | /-F ] [ /OVERWRITE | /APPEND | /-OVERWRITE | /OVERASK ] [ /ALL ] [ /Tpath ] [ /COLOR=nnn | /MONO ] [ /Q ] [ /Iinitfile | /-I ] [ /? ] 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. "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. Still requires a setting other than /NONE to be in effect if you want it to actually do anything besides report on conditions of course. "/-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, /DIFF, /A, /U, /AU, 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, /DIFF, /A, /U, /AU, 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, /DIFF, /A, /U, /AU, 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, /DIFF, /A, /U, /AU, 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, /DIFF, /A, /U, /AU, and /CLONE. DIRCOMP.DOC 5 Revised: 12-22-96 "/CLONE" says to copy all files from directory1 to directory2. Period. The following parameters are all mutually exclusive: /NONE, /DIFF, /A, /U, /AU, 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. /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 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". "/Nfilespec" says to include certain filespecs. You can specify up to 10 inclusion parameters but each must have their own /Nfilespec statement. 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) /I*.EXE /I*.COM". "/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. Note that the inclusions are "OR" conditions; if a file meets any of the attributes in the inclusion, it is allowed (/ATTR=H will retrieve any file with the hidden attribute set, even files that also have the system attribute set). Exclusions are also subject to "OR" conditions. Initially defaults to /ATTR=-H-S-R (skip hidden, system, or read-only files). You can say "/ATTR=" or "/ATTR=HRS" to get all of them. "/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. 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 the default. DIRCOMP.DOC 6 Revised: 12-22-96 "/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. "/Tpath" 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 "/TC:" and "/TC:\TEMP". If not specified, the routine writes to the following in sequence: - the value of any TEMP, then TMP, environmental variable - C:\TEMP - C:\ "/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 14 = light yellow 7 = white 15 = bright white Adding 16 to any color will make the text blink. 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". "/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. "/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.DOC file. Initially defaults to "/IDIRCOMP.INI". "/-I" (or "/INULL") says to skip loading the initialization file. "/?" 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=RHS /S DIRCOMP.DOC 7 Revised: 12-22-96 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 "Wayne Software" at the following address. Additional information about this and other Wayne Software programs can be found in the file BRUCE.DOC 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 fax: (301) 588-8986 e-mail: bguthrie@nmaa.org http://hjs.geol.uib.no/guthrie/ Please provide an Internet e-mail address on all correspondence.