Previous | Table of Contents | Next |
DESCRIPTION
The external dircmp command compares directories. It searches the two directories you specify for matching filenames. If a filename exists in both directories the two files are compared based on the diff command. A list is generated indicating if files with the same name are identical. If a file does not appear in both directories, it is listed as a unique file.
cj> dircmp dir1 dir2 uniq Nov 12 16:41 1989 dir1 only and dir2 only Page 1 ./misc Nov 12 16:41 1989 Comparison of bin misc Page 1 directory. different./vs
The first listing dir1 only and dir2 only states which files and directories are only in the dir1 directory and which are only in the dir2 directory. If the names are left-justified, they are in the dir1 directory. If they are preceded by a tab, they are only in the dir2 directory.
The second list Comparison of dir1 dir2 is a comparison of files with the same name in the bin and misc directories. There are three possibilities in this listing. They are
directory | name | |
different | name | |
same | name |
The first signifies the two names are directories. The second states the contents of the two files are different. The third states the contents of the two files are the same.
| |
BSD (Berkeley) | |
---|---|
Refer to the diff command for comparing directories on BSD systems. | |
|
COMMAND FORMAT
Following is the general format of the dircmp command.
dircmp [ -ds ] [ -wn ] >dir1 dir2
Options
The following list describes the options and their arguments that may be used to control how dircmp functions.
-d | If both directories contain a file with the same name, the two files are compared using the diff command with no options. |
-s | Suppress messages about identical files. |
-w n | Set the width of the output lines to be n characters . If -w n is not specified, the width is set to 72 characters. |
Arguments
The following list describes the arguments that may be passed to the dircmp command.
dir1 | The directory to be searched for unique filenames not contained in dir2 and for filenames that are in dir2 . |
dir2 | The directory to be searched for unique filenames not contained in dir1 and for filenames that are in dir1 . |
RELATED COMMANDS
Refer to the diff command described in Module 33.
RELATED FILES
The dircmp command reads the directory files dir1 and dir2 , then reads and compares files that are common to both directories. It writes output to the standard output.
APPLICATIONS
The dircmp command is used to compare two directories for similarities or differences. Thus you can use it to clean up a duplicate directory. You may want to use it to update a backup directory. It provides an easy way to compare multiple files with only one command.
TYPICAL OPERATION
In this activity you use the dircmp command to compare two directories. Begin at the shell prompt.
cj> dircmp letters db uniq Nov 12 16:41 1989 letters only and db only Page 1 ./file2 ./phone Nov 12 16:41 1989 Comparison of letters db Page 1 directory . different ./file1
Previous | Table of Contents | Next |