filecmp.cmpfiles on directories

Stormin Norm storminDOTnorm at
Wed Jun 12 08:59:59 EDT 2002

Thanks Gordon,
The documentation does not mention the filecmp.dircmp function.  Any 
documentation on filecmp.dircmp anywhere?? 
Do you know if there is any ability with filecmp to walk the tree 
structure. Otherwise I'll use os.path.walk and call filecmp.dircmp.


Gordon McMillan wrote:

>Stormin wrote:
>>I am trying to walk a directory structure and compare directories for 
>>duplicates.  For some reason I get the filecmp to work on individual 
>>files, but not on directories.
>>print dups,"||",common
>For each filename in common, cmpfiles will compare the files
>with that basename in the two directories. What you want
> x = filecmp.dircmp("C:\\comp1","c:\\comp2")
> print x.same_files
> print x.diff_files
>which will figure out "common" and call cmpfiles for you.
>-- Gordon

More information about the Python-list mailing list