Content-type: text/html Manpage of COMPDIR

COMPDIR

Section: Misc. Reference Manual Pages (1L)
Updated: 16 November 1988
Index  

NAME

compdir - compare two directories  

SYNOPSIS

compdir [ -a ] [ -h ] [ -l ] [ -m ] [ -s ] [ -t ] [ -2 ] [ -X pat... ] dir1 dir2  

DESCRIPTION

Compdir recursively compares the files in the two directories dir1 and dir2. By default, it compares the contents of the files and prints nothing if they compare equal; else it prints
directory: path/filename
when filename is a directory under one path but not under the other path;
differ: path/filename
when filename is newer under the printed path than under the other directory;
only: path/filename
when filename exists in one path only.

Plain compdir is about the same speed as diff -r, but compdir -m, which compares modification times instead of contents, is much faster than diff.  

OPTIONS

-a
Compare all files, including files beginning with a dot (.). The default action is to ignore such files.
-h
Summarize the options and exit.
-l
Set stdout to be line buffered.
-m
Compare modification times instead of contents. This is much faster than comparing the contents. It's useful if you expect the directories' files to have the same dates, such as would be the case if you created a copy using tar or cp -rp.
-s
When both files are the same, print lines like
same: path/filename
Normally only non-matches are printed.
-t
Compare contents of files, and if they are the same touch the modification time on the newer file to have the same time as the older file. This is useful if you have created a backup directory but didn't preserve dates. In that case, you can do compdir -t dir1 dir2 once, and thereafter you can more quickly compare the directories by looking at file modification times instead of the file contents.
-1
Print both filenames, instead of just the newer, when files differ or when both are the same, but just the one filename for ``only'' files.
-2
Print both filenames, instead of just the newer, for all compared files. This makes it easy to edit the output into shell commands that, say, copy the newer file to the older. The only or newer file is printed first; the missing or older filename is printed second.
-X pat...
Exclude patterns. Any file in dir1 that matches the sh(1)-style wildcard pattern specified by pat is ignored in comparisons. More than one pattern may be given; it's often necessary to quote the pattern to prevent interpretation by the shell. Note: slashes (/) are treated as ordinary characters when matching names.
 

EXAMPLE

The following command
% compdir -X "*.o" "*.a" mydir mydir.backup
compares the contents of the files in mydir and mydir.backup, ignoring object files and libraries.  

AUTHOR

William Deich


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLE
AUTHOR