57

I am looking for a tool that is able to compare directories, not only files. Also it is important to be able to call the tool from the command line.

It would be great to have a free tool, if not free please specify the price.

| improve this question | | | | |

12 Answers 12

7

For all the googlers... check out Beyond Compare it rules. Costs 30$ or 50$ for Pro version.

| improve this answer | | | | |
  • 1
    I usually try to avoid recommending commercial solution when free and open source alternatives exists but BeyondCompare is a special case where it does worth every penny... and is also multi platform. I have been using it for more 10 years and waited to long to get the MacOS version. – sorin Feb 15 '17 at 10:14
  • It is now April 2020 and the pro version now costs $60. – Keith Bennett Apr 27 at 2:53
52

FileMerge (free), shipped with Xcode, offers a directory view.
A command line version is available through the Terminal application opendiff.

Here's how you can compare two directories with FileMerge:

  1. ⌘+space, type in "FileMerge" and open it.
  2. Click the "left" button and choose the folder you would like to move items FROM. (The "old" folder)
  3. Click the "right" button and choose the folder you would like to move items TO. ("new" folder) and click "Compare" button
  4. In the right panel, choose to exclude: "identical" and "Changed right". This way you will only see files which are missing in the "new" folder and ignore files your may have added in the "new" folder.
  5. Move files manually in Finder or let FileMerge do it, by choosing an option in the "Merge" dropdown in the right panel.
| improve this answer | | | | |
  • 2
    I would like to choose this answer because opendiff could be considered almost "bundled" with the OS X but when I tries to diff two folders it opened an ugly view that was not so easy to understand and also I was not able to see how do I merge two files in file view. I'm sure it is possible but if this basic feature is not obvious, I will prefer to look for something better ;) – sorin Mar 16 '11 at 17:22
41

Built-in utility for macOS and Linux

If you don't mind using the terminal, the diff command can compare directories.
This utility is also available in most Linux distributions.

diff -rq directory1/ directory2/

-r indicates recurse through subdirectories, and -q gives brief output (i.e. don't show the actual diffs, just note what files/dirs are different).

Other useful options are:
-s report identical files,
-i ignore case in file contents,
--ignore-file-name-case ignore case when comparing file names.

If you want to avoid warnings (mostly usefulness warnings) about differences in the .DS_Store files, then use:

diff -rq directory1/ directory2/ | grep -v .DS_Store
| improve this answer | | | | |
  • 1
    You can exclude subfolders directly by diff --exclude node_modules – akauppi Jan 29 at 8:34
20

Diffmerge should meet all your requirements.

| improve this answer | | | | |
  • I just hope that they will make an installer that will be able to install the command line starters and improve the current install experience. – sorin Mar 16 '11 at 17:24
  • 2
    This is an old topic - but I installed it via brew cask install diffmerge and it installed without problems. – Rainer Oct 16 '15 at 7:17
  • Apr 2016: It is still maintained, and still one of my go-to development tools. – JRobert Apr 14 '16 at 13:16
5

Another neat tool to achieve this is rsync, as described on Unix & Linux StackExchange. To compare two folders you can do

rsync -avun $SOURCE $TARGET

And if you are really concerned about file consistency / bit rot there is also the c option to compare file checksums

rsync -avnc $SOURCE $TARGET
| improve this answer | | | | |
  • Great reference for its usefulness on all Unixes 🙏🏻. – dan Jan 2 '19 at 13:23
4

I recently purchased a copy of Kaleidoscope (approx $40 US). It's a clean app.

vimdiff is also available via the commandline and is portable across most UNIXy domains.

| improve this answer | | | | |
  • I've been using Kaleidoscope for a few months now. Worth the price. It goes on sale occasionally. – Ian C. Mar 15 '11 at 13:49
  • Kaleidoscope does not allow you to edit a file, useless! – mathieug Jan 26 '17 at 9:17
  • Price of Kaleidoscope in App Store in 2020: 74,99 eur – akauppi Jan 29 at 8:43
3

You should try the powerful open-source software meld. The Mac version can be found at Meld for OSX. It supports both directory and file comparison and works great under Mac.

I was told to improve this answer and explain why meld is good. Generally speaking, Meld is a full feature comparison software mainly used in GNOME. It is better than a lot of software listed here because

  1. it is free and open source. So you do not need to worry about the fee or security
  2. if not more powerful, it is as sophisticated as a lot of software which asks you a lot of money
  3. it is user-friendly and does not involve complex configuration or typing command in the terminal. You should be able to use it immediately once you install it.

The part that it is not as good might be that it is developed under GTK. So sometimes it does not feel like nature MAC programs. Besides, the old MAC versions were a little buggy. But the latest one 3.19.2 that I am currently using works great and I have never met an issue.

| improve this answer | | | | |
  • Also installation is easy with brew cask install meld – Manfred Moser Feb 21 at 19:42
2

The diff tool that comes with Bare Bones Software's Text Wrangler has directory comparison, although it only shows which files are in both directories, and which are only in each of the directories. When you select a file that's in both you can edit by merging changes line by line with the click of a button. It doesn't let you move files though. You have to do this externally (eg via Finder).
I find it to be one of the better free options.

| improve this answer | | | | |
1

I use Folder Sync It costs $8.99 on the Mac App Store It works really nicely.

| improve this answer | | | | |
0

Easiest solution: Sync the files using Dropbox or similar, then just use WinMerge on Windows.

The FileMerge utility that ships with Xcode doesn't compare folders and doesn't do merge/editing.

| improve this answer | | | | |
0

I have been comparing large folder structures (DVDs) in the past and I had developed a command-line utility to do this. I have recently made the utility (CrcCheckCopy) free and cross-platform (MacOS and Windows).

CrcCheckCopy scans the source folder and creates a file containing the CRC stamps of all files. Then, this file is used to compare the target folder.

You can get it from here: https://www.starmessagesoftware.com/crccheckcopy Your feedback you be much appreciated.

| improve this answer | | | | |
0

Changes app ($37.19) used to be my workforce for this. It's as good as Beyond Compare.

Note: I hope this QA is allowed to exist, though it's against at least SO norms to pitch for products. The need for a usable, intuitive, graphic directory comparison tool for macOS remains acute. Open source candidates have not reached the level of usability that the commercial tools provide.

| improve this answer | | | | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .