/usr/share/doc/diffutils-doc/Comparing-Directories.html is in diffutils-doc 1:3.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for GNU Diffutils
(version 3.5, 4 August 2016),
and documents the GNU diff, diff3,
sdiff, and cmp commands for showing the
differences between files and the GNU patch command for
using their output to update files.
Copyright (C) 1992-1994, 1998, 2001-2002, 2004, 2006, 2009-2016 Free
Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled
"GNU Free Documentation License." -->
<!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Comparing and Merging Files: Comparing Directories</title>
<meta name="description" content="Comparing and Merging Files: Comparing Directories">
<meta name="keywords" content="Comparing and Merging Files: Comparing Directories">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Adjusting-Output.html#Adjusting-Output" rel="next" title="Adjusting Output">
<link href="Incomplete-Lines.html#Incomplete-Lines" rel="prev" title="Incomplete Lines">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Comparing-Directories"></a>
<div class="header">
<p>
Next: <a href="Adjusting-Output.html#Adjusting-Output" accesskey="n" rel="next">Adjusting Output</a>, Previous: <a href="Incomplete-Lines.html#Incomplete-Lines" accesskey="p" rel="prev">Incomplete Lines</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Comparing-Directories-1"></a>
<h2 class="chapter">4 Comparing Directories</h2>
<a name="index-LC_005fCOLLATE"></a>
<p>You can use <code>diff</code> to compare some or all of the files in two
directory trees. When both file name arguments to <code>diff</code> are
directories, it compares each file that is contained in both
directories, examining file names in alphabetical order as specified by
the <code>LC_COLLATE</code> locale category. Normally
<code>diff</code> is silent about pairs of files that contain no differences,
but if you use the <samp>--report-identical-files</samp> (<samp>-s</samp>) option,
it reports pairs of identical files. Normally <code>diff</code> reports
subdirectories common to both directories without comparing
subdirectories’ files, but if you use the <samp>-r</samp> or
<samp>--recursive</samp> option, it compares every corresponding pair of files
in the directory trees, as many levels deep as they go.
</p>
<p>If only one file exists, <code>diff</code> normally does not show its
contents; it merely reports that one file exists but the other does
not. You can make <code>diff</code> act as though the missing file is
empty, so that it outputs the entire contents of the file that
actually exists. (It is output as either an insertion or a
deletion, depending on whether the missing file is in the first or the
second position.) To do this, use the <samp>--new-file</samp>
(<samp>-N</samp>) option. This option affects command-line arguments as
well as files found via directory traversal; for example, ‘<samp>diff
-N a b</samp>’ treats <samp>a</samp> as empty if <samp>a</samp> does not exist but
<samp>b</samp> does, and similarly ‘<samp>diff -N - b</samp>’ treats standard input
as empty if it is closed but <samp>b</samp> exists.
</p>
<p>If the older directory contains large files that are not in
the newer directory, you can make the patch smaller by using the
<samp>--unidirectional-new-file</samp> option instead of <samp>-N</samp>.
This option is like <samp>-N</samp> except that it inserts the contents only
of files that appear in the second directory but not the first (that is,
files that were added). At the top of the patch, write instructions for
the user applying the patch to remove the files that were deleted before
applying the patch. See <a href="Making-Patches.html#Making-Patches">Making Patches</a>, for more discussion of
making patches for distribution.
</p>
<p>To ignore some files while comparing directories, use the
<samp>--exclude=<var>pattern</var></samp> (<samp>-x <var>pattern</var></samp>) option.
This option
ignores any files or subdirectories whose base names match the shell
pattern <var>pattern</var>. Unlike in the shell, a period at the start of
the base of a file name matches a wildcard at the start of a pattern.
You should enclose <var>pattern</var> in quotes so that the shell does not
expand it. For example, the option <samp>-x '*.[ao]'</samp> ignores any file
whose name ends with ‘<samp>.a</samp>’ or ‘<samp>.o</samp>’.
</p>
<p>This option accumulates if you specify it more than once. For example,
using the options <samp>-x 'RCS' -x '*,v'</samp> ignores any file or
subdirectory whose base name is ‘<samp>RCS</samp>’ or ends with ‘<samp>,v</samp>’.
</p>
<p>If you need to give this option many times, you can instead put the
patterns in a file, one pattern per line, and use the
<samp>--exclude-from=<var>file</var></samp> (<samp>-X <var>file</var></samp>) option.
Trailing white space and empty lines are ignored in the pattern file.
</p>
<p>If you have been comparing two directories and stopped partway through,
later you might want to continue where you left off. You can do this by
using the <samp>--starting-file=<var>file</var></samp> (<samp>-S <var>file</var></samp>)
option. This compares only the file <var>file</var> and all alphabetically
later files in the topmost directory level.
</p>
<p>If two directories differ only in that file names are lower case in
one directory and upper case in the upper, <code>diff</code> normally
reports many differences because it compares file names in a
case sensitive way. With the <samp>--ignore-file-name-case</samp> option,
<code>diff</code> ignores case differences in file names, so that for example
the contents of the file <samp>Tao</samp> in one directory are compared to
the contents of the file <samp>TAO</samp> in the other. The
<samp>--no-ignore-file-name-case</samp> option cancels the effect of the
<samp>--ignore-file-name-case</samp> option, reverting to the default
behavior.
</p>
<p>If an <samp>--exclude=<var>pattern</var></samp> (<samp>-x <var>pattern</var></samp>) option,
or an <samp>--exclude-from=<var>file</var></samp> (<samp>-X <var>file</var></samp>) option,
is specified while the <samp>--ignore-file-name-case</samp> option is in
effect, case is ignored when excluding file names matching the
specified patterns.
</p>
<p>To tell <code>diff</code> not to follow a symbolic link, use the
<samp>--no-dereference</samp> option.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Adjusting-Output.html#Adjusting-Output" accesskey="n" rel="next">Adjusting Output</a>, Previous: <a href="Incomplete-Lines.html#Incomplete-Lines" accesskey="p" rel="prev">Incomplete Lines</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|