Even if you’ve installed Xcode, you may not use it much unless you create software for a living. But it’s worth exploring the Developer folder, as it holds some very useful tools. Consider FileMerge, which you’ll find in /Developer -> Applications -> Utilities. This program is typically used to compare two text files—drag files to the Left and Right drop zones in the Compare Files window, and FileMerge will put up a comparison page that shows the differences between the two files. This feature is very handy if you do a lot of work with HTML, PHP, or other pure text files, and often have multiple versions of a basically-identical file on your disk.
But what not many people know is that you can also use FileMerge to compare two folders. For example, say you have two folders of images, and you’d like them to be identical. You could invest in a synchronization utility such as Econ Technologies’ $30 ChronoSync, but that might be overkill for your needs. Instead, give FileMerge a shot. Launch it, then drag one folder into each drop zone in the Compare Files window:
Once you’ve added the folders, just click Compare. FileMerge opens a new window with a list of gray and black filenames. A gray filename indicates that the file is common to both folders. A black filename indicates that the file is unique to one folder. Select a file to see a status message at the bottom of the window. If this says “added to right,” that means the file is only in the folder you placed in the rightmost well. If the message says “added to left,” the opposite is true. To simplify this view, use the Exclude checkboxes. Select the Identical option, for example, if you don’t want to see files that exist in both folders.
If you’d like to look at any of the files, click the View button to display a drop-down menu of options. Choose Comparison (for text files only) to open the traditional FileMerge comparison window, or use the Left File and Right File options to see the actual text or images in the specified folder. The Ancestor and Merge views only apply to people using FileMerge to check code. Read more about these options in FileMerge’s Help file.
If all you wanted to do was to visually compare the two folders’ contents, you’re done. But you can also use FileMerge to actually merge the two folders together into one new one. To do this, select all the files in the leftmost column (click on one and then hit Command-A to select all). Then select Combine Files from the Merge pop-up menu (or press Command-1). FileMerge will ask you for a new directory name, and then proceed to merge the two directories into a new one. Any files that weren’t common to both folders will be added to the new folder, along with all of the identical files.