Diffing directories

Sometimes I would like to recursively compare the files in two directories to see if one is missing in the other. Sometimes I would even like to discover files which contents are different in two directories.
So let’s see how Emacs can support me to do the job.

By executing M-x ediff-directories and inserting the two directories in question (or 3 directories by using ediff-directories3) and an optionally regexp to only match certain files Emacs will open a new buffer that lists the top of both directories.

To recursively compare them and get the differences just press == followed by a D. This will show you all different files. Subdirectories with differences contents dont have the prefix = and can be displayed by pressing enter.

You could also mark different files and directories and get a patch file by executing P.

Another but not builtin diff tool with a nicer UI is Ztree.

After the installation run it with M-x ztree-diff. This opens a new buffer, where you can hide/show all equal files and directories by pressing h and to copy or delete differences with C or D. No need to enter subdirectories thus it will give you a tree view per default.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s