0

Can you please tell me how can I compare the content content of each files under 2 different directories hierarchy? I am on MacOS X platform?

Thank you.

2
  • Try Meld for visual comparison. I use it to compare directories, it can compare 3 folders, files etc. URL: meldmerge.org
    – Kumar
    Sep 4, 2012 at 18:32
  • Kumar, Meld is awesome on Linux. You should add this as an answer - although it requires Fink/Brew/macports to get it. Jun 30, 2014 at 16:49

6 Answers 6

1

DiffMerge may do what you need:

Performs a side-by-side comparison of 2 folders, showing which files are only present in one file or the other, as well as file pairs which are identical or different.

Graphically shows the changes between two files. Includes intra-line highlighting and full support for editing.

3

If you have the developer tools installed, you will have filemerge, which can compare 2 directories. However - if you haven't it would be a rather big thing to install just for that.

2

If you'd like to see the changes for each file in a visual diff program like Kaleidoscope you can do:

diff -rq tantan-s3 tantan-s3-cloudfront | awk '{ print $2 " " $4 }'| xargs -L 1 ksdiff

The diff command with the -q option gets a listing of files that differ in the following format:

Files tantan-s3/readme.txt and tantan-s3-cloudfront/readme.txt differ
Files tantan-s3/wordpress-s3/admin-options.html and tantan-s3-cloudfront/wordpress-s3/admin-options.html differ
Files tantan-s3/wordpress-s3/class-plugin-public.php and tantan-s3-cloudfront/wordpress-s3/class-plugin-public.php differ
Files tantan-s3/wordpress-s3/class-plugin.php and tantan-s3-cloudfront/wordpress-s3/class-plugin.php differ
Files tantan-s3/wordpress-s3/config-sample.php and tantan-s3-cloudfront/wordpress-s3/config-sample.php differ
Files tantan-s3/wordpress-s3.php and tantan-s3-cloudfront/wordpress-s3.php differ

The awk command cleans this up to just have the file names:

tantan-s3/readme.txt tantan-s3-cloudfront/readme.txt
tantan-s3/wordpress-s3/admin-options.html tantan-s3-cloudfront/wordpress-s3/admin-options.html
tantan-s3/wordpress-s3/class-plugin-public.php tantan-s3-cloudfront/wordpress-s3/class-plugin-public.php
tantan-s3/wordpress-s3/class-plugin.php tantan-s3-cloudfront/wordpress-s3/class-plugin.php
tantan-s3/wordpress-s3/config-sample.php tantan-s3-cloudfront/wordpress-s3/config-sample.php
tantan-s3/wordpress-s3.php tantan-s3-cloudfront/wordpress-s3.php

The the xargs command with the -L 1 option executes Kaleidascope for each set of file pairs.

0

I use "Beyond compare" to do it, and it seems that the MAC equivalent is bbedit

1
  • Absolutely not. BBEdit is a general purpose and developers' text editor that perhaps has some diff functionality.
    – Daniel Beck
    Jan 5, 2011 at 12:02
0

If you don't mind using the command line, you can use the UNIX 'diff' command.

An example of a command to run a compare using diff could be:

diff -r /my/first/directory /my/second/directory

This will recursively perform a diff on all common directories and files between the two directories.

Reference: http://www.computerhope.com/unix/udiff.htm

0

Beyond Compare 4 beta now runs also on OSX. It's a good comparison tool with a GUI that could do compare, sync, merge for files and folders.

http://www.scootersoftware.com/beta.php?zz=beta4_dl

You must log in to answer this question.

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