Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to compare two directories which have similar hierarchy.

With "M-x ediff-directories" within Emacs, I was prompted to input a regexp to constrain the name of files I want to compare. For example, I want to compare the files whose name ends with .c or .h. Then I input ".*.[ch]", However, I find that it only take effects on the top level directory, but i want the regexp take effects on the files lied in all the sub-directories, no matter what the depth it is.

Any idea?

share|improve this question
up vote 0 down vote accepted

As I recall, edif-dirs is not recursive. I haven't tried it myself, but this package seems to do what you want:

The EdiffTrees package is a simple frontend to EdiffMode to allow a simpler comparison of two similar directory trees.

I wrote this package because I often need to compare two different versions of the same directory tree and ediff-directories is not very helpful in this case. Specially when the directory trees to compare are deep and only a few files have changed.

For further instructions, please see the comentary in the file.

Alternatively, assuming you are on a unix-like OS, you can go into eshell mode (M-x eshell), and run:

diff -r dir1 dir2

Kind of a hack really, but hey, you're still in emacs!

share|improve this answer
diff -r, that's too un-emacs, :P – hero2008 Aug 16 '12 at 6:33
Heh, I know I know, but technically eshell is still in emacs your honor, I swear! :) – terdon Aug 16 '12 at 14:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.