How filecmp walk into subdirectories?

John Gordon gordon at panix.com
Tue Nov 1 23:14:44 EDT 2011


In <d0c0b3f4-ce8b-489f-9334-2b5d807f6ed4 at es7g2000vbb.googlegroups.com> Muddy Coder <cosmo_general at yahoo.com> writes:

> I tried to compare two directories, each with hundreds of files in
> multiple level subdirectories, to find out the different files. I used
> filecmp module to the job as:

> comp=filecmp.dircmp(adir, bdir)
> comp.report()

> It worked, and printed out the identical and different files. However,
> it did not go through the directory trees, just did the job in the
> first level. I wonder somebody can help? Thanks in advance!

report() only prints information on the first-level contents of the two
directores, as you saw.  It doesn't do subdirectories.

If you want subdirectories, use report_full_closure().

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list