Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Try Meld for visual comparison. I use it to compare directories, it can compare 3 folders, files etc. URL: meldmerge.org –  Kumar Sep 4 '12 at 18:32
add comment

migrated from stackoverflow.com Jan 4 '11 at 20:42

This question came from our site for professional and enthusiast programmers.

5 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
Absolutely not. BBEdit is a general purpose and developers' text editor that perhaps has some diff functionality. –  Daniel Beck Jan 5 '11 at 12:02
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.