This weekend, I had a situation, due to a laptop hard drive failure, where I had two very large directories full of files and subdirectories. Each was a copy of the same directory, but one had my last 4 days of coding in it and the other didn’t. The trick was to find the files I had changed over the course of my last few days of development so I could get them back into the other directory, and then into my source countrol.

So I searched the Internet to see if there was a tool to help me determine the difference in all the files in my directories. I use both Windows and Linux, so I hoped, against the odds that I could find a tool that worked on both.

Thankfully, I found just the tool: KDiff3. I downloaded KDiff3, installed it, and started it up. When the app loads, a small window launches, which lets you select a File or a Directory for the base and for the comparison against the base. You then click ok, and within a few seconds have a list of all differences within the subdirectories. It flags the files that are different and then shows you the differences within the files. You can merge files, choose one or the other side to overwrite, etc. You can also do a three way comparison with three sources.

I was able to use this tool to get my folders in sync and save all my changes. What I thought would be a several hour process was finished in minutes thanks to KDiff3. There are a lot of configuration options that I haven’t tried yet. It looks to be full of features for file and directory comparision and merging.

I highly recommend this tool, and I’ve tried it on Windows XP and Suse 10.0. You can visit the KDiff homepage for more information.