dircmp — Compare directories

Format

dircmp [-Bds] [-W option[,option]...] dir1 dir2

Guideline: The dircmp utility is fully supported for compatibility with older UNIX systems. However, use diff –r instead because it may provide greater functionality and is considered the standard for portable UNIX applications as defined by POSIX.2 IEEE standard 1003.2-1992.

Description

dircmp examines dir1 and dir2 and generates listings about the contents of the directories. Listings of files that are unique to each directory are generated for all the options. If no option is entered, a list is output indicating whether the filenames common to both directories have the same contents.

Options

–B
Disables the automatic conversion of tagged files. This option is ignored if the filecodeset or pgmcodeset options (-W option) are specified.
–d
Compares the contents of files with the same name in both directories and creates a list telling what must be changed in the two files to bring them into agreement. The list format is described in diff.
–s
Suppress messages about identical files.
-W option[,option]...
Specifies z/OS-specific options. The option keywords are case-sensitive. Possible options are:
filecodeset=codeset
Performs text conversion from one code set to another when reading from the file. The coded character set of the file is codeset. codeset can be a code set name known to the system or a numeric coded character set identifier (CCSID). Note that the command iconv -l lists existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options can be used on files with any file tag.

If pgmcodeset is specified but filecodeset is omitted, then the default file code set is ISO8859-1 even if the file is tagged with a different code set. If neither filecodeset nor pgmcodeset is specified, text conversion will not occur unless automatic conversion is enabled or the _TEXT_CONV environment variable indicates text conversion. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.

If filecodeset or pgmcodeset is specified, then automatic conversion is disabled for this command invocation and the -B option is ignored if it is also specified. See z/OS UNIX System Services Planning for more information about automatic conversion.

When specifying values for filecodeset, use the values that Unicode Service supports. For more information about supported code sets, see z/OS Unicode Services User's Guide and Reference.

pgmcodeset=codeset
Performs text conversion from one code set to another when reading from the file. The coded character set of the program (command) is codeset. codeset can be a code set name known to the system or a numeric coded character set identifier (CCSID). Note that the command iconv -l lists existing CCSIDs along with their corresponding code set names. The filecodeset and pgmcodeset options can be used on files with any file tag.

If filecodeset is specified but pgmcodeset is omitted, then the default program code set is IBM-1047. If neither filecodeset nor pgmcodeset is specified, text conversion will not occur unless automatic conversion is enabled or the _TEXT_CONV environment variable indicates text conversion. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.

If filecodeset or pgmcodeset is specified, then automatic conversion is disabled for this command invocation and the -B option is ignored if it is also specified. See z/OS UNIX System Services Planning for more information about automatic conversion.

Restriction: The only supported values for pgmcodeset are IBM-1047 and 1047.

Examples

  1. To compare the contents of two directories, showing files that are identical, files that differ, and files or directories that are unique to a directory:
    dircmp MyDir01 MyDir02
  2. To compare the contents of two directories and only show files that differ, along with a listing of those differences, and files or directories that are unique to a directory:
    dircmp -ds MyDir01 MyDir02
  3. To compare the contents of two directories consisting of text files containing ASCII characters, showing files that are identical, files that differ, along with a listing of those differences, and files or directories that are unique to a directory, assuming that:
    • The text files are untagged and you do not want to tag them or enable automatic conversion, and
    • You cannot alter the tag (for example, you are comparing untagged public text files or read-only text files):
    dircmp -d -W filecodeset=ISO8859-1,pgmcodeset=IBM-1047 MyAsciiDir01 MyAsciiDir02
  4. To compare the contents of two directories consisting of text files containing EBCDIC characters and only show files that differ, along with a listing of those differences, and files or directories that are unique to a directory, assuming that automatic conversion has been enabled but the text files are incorrectly tagged as UTF-8:
    dircmp -Bds MyMisTaggedDir01 MyMisTaggedDir02

Localization

dircmp uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Environment variables

dircmp uses the following environment variable:
_TEXT_CONV
Contains text conversion information for the command. The text conversion information is not used when either the -B option or the filecodeset or pgmcodeset option (-W option) is specified. For more information about text conversion, see Controlling text conversion for z/OS UNIX shell commands.

Exit values

0
Successful completion
>0
  • The code set is not valid
  • Could not turn off automatic conversion
  • Could not perform requested text conversion

Related information

cmp, diff