<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"prev" href=
"module-filecmp.html" />
<link rel=
"parent" href=
"module-filecmp.html" />
<link rel=
"next" href=
"module-subprocess.html" />
<meta name='aesop' content='information'
/>
<title>6.7.1 The dircmp class
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"6.7 filecmp "
href=
"module-filecmp.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"6.7 filecmp "
href=
"module-filecmp.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"6.8 subprocess "
href=
"module-subprocess.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-filecmp.html">6.7 filecmp
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-filecmp.html">6.7 filecmp
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-subprocess.html">6.8 subprocess
</A>
<!--End of Navigation Panel-->
<H2><A NAME=
"SECTION008710000000000000000"></A><A NAME=
"dircmp-objects"></A>
6.7.1 The
<tt class=
"class">dircmp
</tt> class
<tt class=
"class">dircmp
</tt> instances are built using this constructor:
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><span class=
"typelabel">class
</span> <tt id='l2h-
1816' xml:id='l2h-
1816'
class=
"class">dircmp
</tt></b>(
</nobr></td>
<td><var>a, b
</var><big>[
</big><var>, ignore
</var><big>[
</big><var>, hide
</var><big>]
</big><var></var><big>]
</big><var></var>)
</td></tr></table></dt>
Construct a new directory comparison object, to compare the
directories
<var>a
</var> and
<var>b
</var>.
<var>ignore
</var> is a list of names to
ignore, and defaults to
<code>['RCS', 'CVS', 'tags']
</code>.
<var>hide
</var> is a
list of names to hide, and defaults to
<code>[os.curdir, os.pardir]
</code>.
The
<tt class=
"class">dircmp
</tt> class provides the following methods:
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
1817' xml:id='l2h-
1817'
class=
"method">report
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Print (to
<code>sys.stdout
</code>) a comparison between
<var>a
</var> and
<var>b
</var>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
1818' xml:id='l2h-
1818'
class=
"method">report_partial_closure
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Print a comparison between
<var>a
</var> and
<var>b
</var> and common immediate
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
1819' xml:id='l2h-
1819'
class=
"method">report_full_closure
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Print a comparison between
<var>a
</var> and
<var>b
</var> and common
subdirectories (recursively).
The
<tt class=
"class">dircmp
</tt> offers a number of interesting attributes that may
be used to get various bits of information about the directory trees
Note that via
<tt class=
"method">__getattr__()
</tt> hooks, all attributes are
computed lazily, so there is no speed penalty if only those
attributes which are lightweight to compute are used.
<dl><dt><b><tt id='l2h-
1820' xml:id='l2h-
1820'
class=
"member">left_list
</tt></b></dt>
Files and subdirectories in
<var>a
</var>, filtered by
<var>hide
</var> and
<dl><dt><b><tt id='l2h-
1821' xml:id='l2h-
1821'
class=
"member">right_list
</tt></b></dt>
Files and subdirectories in
<var>b
</var>, filtered by
<var>hide
</var> and
<dl><dt><b><tt id='l2h-
1822' xml:id='l2h-
1822'
class=
"member">common
</tt></b></dt>
Files and subdirectories in both
<var>a
</var> and
<var>b
</var>.
<dl><dt><b><tt id='l2h-
1823' xml:id='l2h-
1823'
class=
"member">left_only
</tt></b></dt>
Files and subdirectories only in
<var>a
</var>.
<dl><dt><b><tt id='l2h-
1824' xml:id='l2h-
1824'
class=
"member">right_only
</tt></b></dt>
Files and subdirectories only in
<var>b
</var>.
<dl><dt><b><tt id='l2h-
1825' xml:id='l2h-
1825'
class=
"member">common_dirs
</tt></b></dt>
Subdirectories in both
<var>a
</var> and
<var>b
</var>.
<dl><dt><b><tt id='l2h-
1826' xml:id='l2h-
1826'
class=
"member">common_files
</tt></b></dt>
Files in both
<var>a
</var> and
<var>b
</var>
<dl><dt><b><tt id='l2h-
1827' xml:id='l2h-
1827'
class=
"member">common_funny
</tt></b></dt>
Names in both
<var>a
</var> and
<var>b
</var>, such that the type differs between
the directories, or names for which
<tt class=
"function">os.stat()
</tt> reports an
<dl><dt><b><tt id='l2h-
1828' xml:id='l2h-
1828'
class=
"member">same_files
</tt></b></dt>
Files which are identical in both
<var>a
</var> and
<var>b
</var>.
<dl><dt><b><tt id='l2h-
1829' xml:id='l2h-
1829'
class=
"member">diff_files
</tt></b></dt>
Files which are in both
<var>a
</var> and
<var>b
</var>, whose contents differ.
<dl><dt><b><tt id='l2h-
1830' xml:id='l2h-
1830'
class=
"member">funny_files
</tt></b></dt>
Files which are in both
<var>a
</var> and
<var>b
</var>, but could not be
<dl><dt><b><tt id='l2h-
1831' xml:id='l2h-
1831'
class=
"member">subdirs
</tt></b></dt>
A dictionary mapping names in
<tt class=
"member">common_dirs
</tt> to
<tt class=
"class">dircmp
</tt> objects.
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"6.7 filecmp "
href=
"module-filecmp.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"6.7 filecmp "
href=
"module-filecmp.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"6.8 subprocess "
href=
"module-subprocess.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-filecmp.html">6.7 filecmp
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-filecmp.html">6.7 filecmp
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-subprocess.html">6.8 subprocess
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.