filecmp.dircmp()
filecmp.dircmp() is a Python function in the Filecmp Module category. Creates a directory comparison object with detailed differences. The syntax is filecmp.dircmp(a, b, ignore=None, hide=None). Returns: Dircmp object. A typical example: dcmp = filecmp.dircmp("dir1", "dir2")
dcmp.report() # Summary report
dcmp.left_only # Files only in dir1
dcmp.right_only # Files only in dir2
dcmp.same_files # Files that match. A close sibling is filecmp.cmp(), which compares two files for equality (by content, not metadata). A close sibling is filecmp.cmpfiles(), which compares files in two directories and returns 3 lists: match, mismatch, errors. More about this category: File comparison — cmp, cmpfiles, dircmp. Related Filecmp Module entries: filecmp.cmp(), filecmp.cmpfiles(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try filecmp.dircmp() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.