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.

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

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

  • 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
  • Kumar, Meld is awesome on Linux. You should add this as an answer - although it requires Fink/Brew/macports to get it. – Danny Staple Jun 30 '14 at 16:49
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

  • 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
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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