filecmp.cmpfiles on directories

Stormin Norm storminDOTnorm at excite.com
Wed Jun 12 09:05:34 EDT 2002


Already found the documented details under the dircmp class definition. 
 I did not associate this class with being a function of filecmp.
Thanks for your help.
-Stormin.


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.
>>
>
>>example:
>>DOES NOT WORK:
>>dups=filecmp.cmpfiles("C:\comp1","c:\comp2",common)
>>print dups,"||",common
>>result:
>>([],[],[])||
>>
>
>For each filename in common, cmpfiles will compare the files
>with that basename in the two directories. What you want
>is:
> 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
>http://www.mcmillan-inc.com/
>




More information about the Python-list mailing list