Name
dircmp
Synopsis
class dircmp(dir1,dir2,ignore=('RCS','CVS','tags'),hide=('.',’..'))
Creates a new directory-comparison instance object, comparing
directories named dir1 and
dir2, ignoring names listed in
ignore, and hiding names listed in
hide. A dircmp instance
d exposes three methods:
-
d.report( ) Outputs to
sys.stdouta comparison betweendir1anddir2-
d.report_partial_closure( ) Outputs to
sys.stdouta comparison betweendir1anddir2and their common immediate subdirectories-
d.report_full_closure( ) Outputs to
sys.stdouta comparison betweendir1anddir2and their common subdirectories, recursively
A dircmp instance d
supplies several attributes, computed just in time (i.e., only if and
when needed, thanks to a __getattr__ special
method) so that using a dircmp instance suffers no
unnecessary overhead. d’s
attributes are:
-
d.common Files and subdirectories that are in both
dir1anddir2-
d.common_dirs Subdirectories that are in both
dir1anddir2-
d.common_files Files that are in both
dir1anddir2-
d.common_funny Names that are in both
dir1anddir2for whichos.statreports an error or returns different kinds for the versions in the two directories-
d.diff_files Files that are in both
dir1anddir2but with different contents-
d.funny_files Files that are in both
dir1anddir2but could not be compared-
d.left_list Files and subdirectories that are in
dir1-
d.left_only Files and subdirectories that are in
dir1and not indir2-
d.right_list Files and subdirectories ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access