My favorite file comparison tool was Beyond Compare but since I recently switched to OS X, i'm no longer able to use it and I'm looking for an alternative, preferably a free one. Update: I made the mistake not to specify that I am also looking for a tool that does directory comparison, not only files.
There is a great command line tool that can be used to compare files to see if there are any content or binary code differences that you can access if you are using a PC. File Compare or FC as we will refer to is from here on out, is a simple program that will compare the contents of text or binary files and is capable of comparing both ASCII and Unicode text. You can use this tool to display any lines from two files or two sets of files that do not match up with the others.
File Compare’s Switches and Parameters
- /B – This switch will perform a binary comparison.
- /C – If you need to do a case insensitive comparison, use this switch.
- /A – This switch will make FC show only the first and last lines for each group of differences.
- /U – Use this switch to compare files as Unicode text files.
- /L – This will compare your files as ASCII text.
- /N – This switch can only be used with ASCII but it will show all the corresponding line numbers.
- /LBn – Replace the “n” with a number to limit the amount of consecutive different lines that FC will read before it will abort. The default, if you do not specify a number is 100 lines of mismatched text.
- /nnnn – Replacing the “n’s” here will tell FC that when it finds mismatched lines, it can only continue if it finds “n” consecutive matching lines after the mismatch. This is useful if you want to prevent two files from becoming extremely out of sync.
- /T – This switch will tell FC not to expand tabs to spaces.
- /W – If you use this switch, FC will compress white space (tabs and spaces) during its comparison of your files.
There is only one parameter you will need to specify, but you will need to enter two instances of it. This is the Pathname parameter in which you will state the location of your files.
FC’s Syntax
Like every tool in command prompt, you will need to know how to enter your commands with the proper syntax. There are two main options for the File Compare tool that you can use. If you want to compare two sets of files instead of two individual files, you can use wildcards (? and *).
Depending on your command, you will receive one of four %errorlevel% responses.
- -1 – Your syntax is incorrect.
- 0 – Both files are identical.
- 1 – The files are different.
- 2 – At least one of the files can’t be found.
Let’s Practice
Before we get started, you should download our three sample text documents which we will use for the test. These documents each contain a paragraph of text with a few similar word groupings. Once you have downloaded these three documents, you can copy them into any folder on your computer. For the purposes of this tutorial, we will put all the text documents on the desktop.
Now you will need to open up an elevated command prompt window. Open the start menu in Windows 7 and 10 or open the search function in Windows 8 and search for CMD. Next, right-click on it and then press “Run as administrator.” While you don’t need to open an elevated command prompt window, it will help you to avoid any pesky confirmation dialog boxes.
Our tutorial today will cover several simple scenarios which will be elaborated on below.
- Compare two text files in the same folder using File Compare.
- Compare files in the same folder using File Compare using the “/lbn” switch.
- Compare two identical files.
- Perform a binary comparison of two different files and two identical files.
Scenario 1 – Compare two text files using File Compare.
Best File Comparison Tool For Mac
Now that you have your command prompt window open and you have your text files on your desktop, we are ready to do a simple file comparison. In this section, we will do a basic comparison, and then add a few different options. Begin by entering the following command to compare the contents of “FCsample” and “FCexercise.” Remember to substitute the pathname with the name that matches your computer, and remember that command prompt is not case sensitive.
In this case, all the text from both documents is shown because they do not match up properly.
Scenario 2 – Compare files in the same folder using File Compare using the “/lbn” switch.
Now, let’s try another comparison in which we will tell FC to stop after 2 lines of mismatched data. Do this, by adding the “/lbn” switch.
As you can see, you receive an error message which says “Resync Failed. Files are too different.” This is because there are more than two consecutive lines of mismatched data. Try changing the numbers or editing the files yourself and play with the file compare tool to see what results you get.
Scenario 3 – Compare two identical files.
In the files you downloaded, you will see two files called “FCexercise” and “FCexercise2.” These two files have exactly the same content, so we will perform a comparison and see what results we get.
As you can see from the image above, FC reports that no differences were encountered. If you were to edit one file, add a single letter, and try the command again, your results would show up as in the image below. Note that the only thing that was changed was the addition of the letter “a.”
Scenario 4 – Perform a binary comparison of two different files and two identical files.
Beyond Compare
For this example, we will be performing a binary comparison of the “FCexercise” and “FCsample” files.
You will notice that the function begins by informing you that the two files are being compared. Next, a bunch of binary digits scroll by, which is where the files are being compared, side by side, and lastly, you receive a report that says that, FCexercise is longer than FCsample. For this next example, we will be performing a binary comparison of the “FCexercise” and “FCexercise2” files.
Win Diff
In this comparison of two identical files, FC reports that there is no difference between the two files. Now that you know the basics of the FC tool, feel free to play with the switches and test out some new ideas. Remember that while you are playing with files, it is best to use dummy samples like the ones provided here, in order to avoid any accidental data loss.
Mac File Compare
Image Credit: Nikki on Flickr
READ NEXT- › What Can I Do with My Old iPhone?
- › How to Stream UFC 242 Khabib vs. Poirier Live Online
- › Free Download: Microsoft’s PowerToys for Windows 10
- › How to Overclock Your Computer’s RAM
- › What’s New in Chrome 77, Arriving September 10
Best File Comparison Tool For Windows 7
Free File Comparison Tool
File compare software are those software that make the developers able to make the comparison and compare the multiple files to find out the duplicate one. The term data comparison itself stand for calculation and display of the differences and similarities between data objects. These make the developers and programmers able to compared objects like text files and source code to ensure there is no duplication at all. The overall process and the result obtained from that process in known as diff because of UNIX diff utility. The differences then present by most of the file comparing tools in form of graphical user interface or as part of larger tasks in file systems, networks or revision control. There are many text editors and word processors that are capable in performing file compare functions but at basic levels. In order to get the full highlight of the possible differences or similarities, the developers and programmers are advised to go for advanced file compare software. The software listed below are capable in performing the functions of file comparison between multiple files. These enables the user to compare files and folders quickly and merge the changes, synchronize their files and generates reports for their own records. These will allow the users to compare even entire drives in addition to folder and files at high speed and heck just size and modified times or verify each file with the byte-by-byte comparison.