| | |
- _cmp(a, b, sh, st)
- # Compare two files.
# Return:
# 0 for equal
# 1 for different
# 2 for funny cases (can't stat, etc.)
- _do_cmp(f1, f2)
- _filter(list, skip)
- # Return a copy with items that occur in skip removed.
- _sig(st)
- cmp(f1, f2, shallow=1, use_statcache=0)
- 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.
use_statcache -- Do not stat() each file directly: go through
the statcache module for more efficiency.
Return value:
integer -- 1 if the files are the same, 0 otherwise.
This function uses a cache for past comparisons and the results,
with a cache invalidation mechanism relying on stale signatures.
Of course, if 'use_statcache' is true, this mechanism is defeated,
and the cache will never grow stale.
- cmpfiles(a, b, common, shallow=1, use_statcache=0)
- 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
use_statcache -- if true, use statcache.stat() instead of os.stat()
Returns a tuple of three lists:
files that compare equal
files that are different
filenames that aren't regular files.
- demo()
- # Demonstration and testing.
|