5

I am using BeyondCompare 4 on Windows 10 to compare two directories with thousands of files.

They are the basically same, but one exported from Windows, and another one from Linux. The only difference is that

Windows (DOS) uses CR/LF at the end of line and Unix just uses LF. (LF is / means New Line)

And in Beyond Compare what we see as different when one opens the file is that one says "PC", the other one says "UNIX" (see image below):

enter image description here

After opening the file and closing it, Beyond Compare now sees the files as equal, and if I refresh, they don't appear as different.

As I have thousands of files, and don't want to manually open all of them, how do I ignore the ones whose difference is only the one I mention in the image above?

Tried pressing "Minor", but it doesn't work as well.


Using the following script

find . -type f -print0 | xargs -0 unix2dos

Solves the issue, by converting from UNIX to DOS, but I wonder how to do it by default inside Beyond Compare, and if it is possible.

3 Answers3

9

Beyond Compare's Folder Compare defaults to comparison of file size and timestamp.

Windows CRLF on one side and Unix/Linux LF on the other side results in a size difference despite other text content being the same. When you double click on files, the text contents are compared and found equal. When you close the Text Compare, the Folder Compare is updated with the result of that comparison.

To compare files in the Folder Compare using the same method as viewing the file contents in Beyond Compare's Folder Compare:

  1. Click the Rules toolbar button (referee icon).
  2. Go to the Comparison tab.
  3. Check Compare Contents.
  4. Select Rules-based comparison.
  5. Click OK.
  6. In the Folder Compare, make sure View > Ignore Unimportant Differences is turned on.
0

I am using BeyondCompare 4 on Windows 10 to compare two directories with thousands of files.

They are the same, but one exported from Windows, and another one from Linux

The files are not the same which is why Beyond Compare does not see them as the same. (I have and use Beyond Compare).

Windows (DOS) uses CR/LF at the end of line and Unix just uses LF. (LF is / means New Line)

Windows vs Unix end of line

DOS vs. Unix Line Endings Text files created on DOS/Windows machines have different line endings than files created on Unix/Linux. DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n"). You need to be careful about transferring files between Windows machines and Unix machines to make sure the line endings are translated properly.

The CDF staff have written a thorough explanation of converting between Unix and DOS files

In the directory /u/csc207h/winter/pub/bin, you will find a little Perl program called dos2unix that will conver DOS line endings to Unix line endings. You can set your path to include this directory so that you can run the program, or you can copy it to your own bin directory. Run the program as dos2unix . The file is modified.

IMPORTANT: You must submit files in the CVS directory with Unix/Linux file endings. If you only use CVS to transfer files between your home machine and CDF, you should not have to worry about line endings. However, you must test your programs on CDF before you submit them. Shell programs, in particular, will fail in mysterious ways if they contain DOS line endings.

Now I also found in the Scooter forums that you can ignore unimportant differences and that may indeed help you.

Ignore Unimportant Differences.

The previous post mentioned is actually requesting to ignore line endings and compare text regardless of where it breaks.

We fully support both ignoring the line endings, and 'forcing' the binary compare on the folder compare level without needing to double click the files.

Here's a quick KB article that should help: http://www.scootersoftware.com/suppo...ferentthensame

The line ending importance is controlled per session/instance. You can set a global default from the Home screen -> Edit Session defaults (green folder in the saved session list), Text Compare. And in the Importance tab, Compare Line Endings (PC/Mac/Unix) should already be disabled, which is the default.

The Folder Compare does not use this information by default, however, and will compare using the attributes timestamp/size for a quick comparison. You can make this initial scan more detailed in the Folder Compare Session Settings, and enable a Rules-based compare (same as double clicking) or a Binary or CRC compare.

Let us know if you have any questions.

enter image description here

0

This shouldn't be happening - Beyond Compare should by default ignore the difference in line endings.

From the Text Compare Importance Settings that says this about the parameters in Session > Session Settings > Importance:

Beyond Compare normally ignores differences in line ending style, such as CR+LF in Windows text files vs. LF only in Unix files. To find differences in line endings on a line-by-line basis, mark the Compare line endings (PC/Mac/Unix) checkbox. (To examine the line endings, mark View > Visible Whitespace enter image description here.)

Check the settings indicated in the above text and verify that they are correct.

You might also be running into the problem because you are comparing folders rather than files.

I quote from the end of the post How to ignore CRLF ?:

The line ending importance is controlled per session/instance. You can set a global default from the Home screen -> Edit Session defaults (green folder in the saved session list), Text Compare. And in the Importance tab, Compare Line Endings (PC/Mac/Unix) should already be disabled, which is the default.

The Folder Compare does not use this information by default, however, and will compare using the attributes timestamp/size for a quick comparison. You can make this initial scan more detailed in the Folder Compare Session Settings, and enable a Rules-based compare (same as double clicking) or a Binary or CRC compare.

I don't use Beyond Compare so can't help with the details. You will need to examine and verify all these settings.

harrymc
  • 498,455