Module filecmp
[hide private]
[frames] | no frames]

Module filecmp

Utilities for comparing files and directories.

Classes:
    dircmp

Functions:
    cmp(f1, f2, shallow=1) -> int
    cmpfiles(a, b, common) -> ([], [], [])

Classes [hide private]
dircmp
A class that manages the comparison of 2 directories.
Functions [hide private]
 
cmp(f1, f2, shallow=1)
Compare two files.
 
_sig(st)
 
_do_cmp(f1, f2)
 
cmpfiles(a, b, common, shallow=1)
Compare common files in two directories.
 
_cmp(a, b, sh, abs=<built-in function abs>, cmp=<function cmp at 0x409bca04>)
 
_filter(flist, skip)
 
demo()
Variables [hide private]
  _cache = {}
  BUFSIZE = 8192

Imports: os, stat, warnings, ifilter, ifilterfalse, imap, izip


Function Details [hide private]

cmp(f1, f2, shallow=1)

 
Compare two files.

Arguments:

f1 -- First file name

f2 -- Second file name

shallow -- Just check stat signature (do not read the files).
           defaults to 1.

Return value:

True if the files are the same, False otherwise.

This function uses a cache for past comparisons and the results,
with a cache invalidation mechanism relying on stale signatures.

cmpfiles(a, b, common, shallow=1)

 
Compare common files in two directories.

a, b -- directory names
common -- list of file names found in both directories
shallow -- if true, do comparison based solely on stat() information

Returns a tuple of three lists:
  files that compare equal
  files that are different
  filenames that aren't regular files.