February 2006
Intermediate to advanced
648 pages
14h 53m
English
The filecmp module provides the following functions, which can be used to compare files and directories:
cmp(file1, file2[, shallow])
Compares the files file1 and file2 and returns True if they’re equal, False if not. By default, files that have identical attributes as returned by os.stat() are considered to be equal. If the shallow parameter is specified and is False, the contents of the two files are compared to determine equality.
cmpfiles(dir1, dir2, common[, shallow])
Compares the contents of the files contained in the list common in the two directories dir1 and dir2. Returns a tuple containing three lists of filenames (match, mismatch, errors).match lists the files that are the same in both directories, mismatch lists the