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.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
For all the googlers... check out Beyond Compare it rules. Costs 30$ or 50$ for Pro version.
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:
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
Diffmerge should meet all your requirements.
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
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
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.
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.
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.
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.