How to Know the Difference Between Two Files or Directories Easily

Meld is an application that is used to compare the contents of a directory or file. In my experience, for a programmer, this application is very useful. For example, when we are working with several teams, with meld we can compare the directory or file that we are working on with the directory or file that other team members might work on. When the contents of a directory or file are different, Meld will mark the contents of the file with several different colors.

Meld is an open source application. If you are a Windows user please download here. Meanwhile, if you are a Linux user derivative of Ubuntu, like Linux Mint, Kubuntu, etc., please install it from the software center.

When we open the Meld, a window will appear like in the image below.

A view of Meld application

Then we just have to choose that we want to compare a file or directory. For example, we can choose the Directory Comparison to compare the contents of 2 directories. Then select the respected directories that we want to be compared. Like in the image below.

Compare 2 directories in Meld

By default we can compare 2 files or directories only, if you want to compare 3 files or directories, click the 3-way comparison check box then the dropdown to select the third file or directory will be enabled.

Then click the Compare button to start comparing files or directories. Depending on the size of the files or directories the process may take some time.

Furthermore, the contents of the file or directory will be displayed in a different tab. When we compare directories there are 3 color codes used by Meld. If the file name color is black it means that the file contents are the same, there is no difference.

If it is blue, it means that the contents of the files are different, either partially or completely. If it is green it means that the file does not exist in the opposite directory. Meanwhile, if a file or directory has a line in the middle it means that the file or directory does not exist in the active directory, but exists in the opposite directory, the opposite of the green color code.

A result of comparing 2 directories in Meld

Right click on the file then a popup will appear with choice of Copy to left or Copy to right depending on where we click. Use this option to copy and replace the file or directory from the right directory to the left directory or vice versa.

An popup in Meld with several choice

If you want to see the difference of the file contents, double-click one of the file names. Then the contents of both files with the same name will be displayed in another tab.

Compare 2 file contents in Meld

The difference of both file’s contents will be displayed in 2 color codes. If it is blue its means that a block of content exists in both files with a small part that different. If it is green its means that a block of the content does not exist in the opposite file.

Use the arrow in the middle of the page to copy the content of the right file to the left file and vice versa. Also pay attention to the scroll bar in the right part of the application, the more green lines or blue lines in that section, its means that both files have more content that different. If your file is large and has many lines, you can move the scroll bar directly on the green or blue lines in that section to navigate quickly.

Related Article

Leave a Reply

Your email address will not be published. Required fields are marked *