filecmp.cmpfiles()
filecmp.cmpfiles() is a Python function in the Filecmp Module category. Compares files in two directories and returns 3 lists: match, mismatch, errors. The syntax is filecmp.cmpfiles(dir1, dir2, common, shallow=True). Returns: (match, mismatch, errors) tuple. A typical example: match, mismatch, errors = filecmp.cmpfiles("dir1", "dir2", ["a.txt", "b.txt"]). A close sibling is filecmp.cmp(), which compares two files for equality (by content, not metadata). A close sibling is filecmp.dircmp(), which creates a directory comparison object with detailed differences. More about this category: File comparison — cmp, cmpfiles, dircmp. Related Filecmp Module entries: filecmp.cmp(), filecmp.dircmp(). 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.cmpfiles() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.