Compare files and folders

When you need to compare files and folders (and folder trees), you can use the bash command diff.

I analyze the complex case of compare folder trees, for example when you have two directory trees maked in the same mode, but not really equal.
So, you must type:

$ diff -rw project1/ project2/ | diffstat

where i use the -r option to recursively compare any subdirectories, and the option -w to ignore all whte spaces.
At the end, i use the diffstat command to make histogram from diff-output, that transform the output in a best view.

If you have too many files and folders to analyze, you can read in the best way using the less command, appended after diffstat with a pipe.


Enjoy!!  😉


2 Responses to Compare files and folders

  1. It’s impressive that you are getting thoughts from this article as well as from our argument made here.

  2. fcastagnotto says:

    um….what? I don’t understand..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: