在用BC比较两个文件目录时,经常会用到"Actions">"Compare Contents"命令,发现有时即使两个文件完全相同的目录比较完成后也是红色(有差异),但单个文件打开比较并关闭后才变成黑色。此时如果要比较有很多个文件的代码目录时每个都打开比较不太现实。搜素了下发现只需要在Action:的单选按钮中选择"Rules-based comparison"即可解决目录比较的问题。
同时,如果想打开就开始自动比较,需设置:"Session" > "Session Settings..." > "Comparison" Tab: 在"Requires opening files:" 下选中"Compare contents"并选择"Rules-based comparison"选项。
Reference:
Q: I just purchased the pro version of Beyond Compare 4 for Windows. I'm using it to compare a Windows folder to a folder on a Linux machine using SFTP. When I select all of the files and do a 'Compare Contents', I wold expect the color to change to black if the files are the same. This is not happening. If I double click on a file to open a new tab displaying the file contents and then close that tab, the color changes to black (of course, only when the files are the same). I'm guessing this has something to do with the fact that I'm using SFTP or that I'm comparing Windows files to Linux files. I have over 4 thousand files to compare so opening each one is not a viable option. This has always worked for me when comparing windows files (and I've been using BC for years). Thanks for any help.
A: Based on what you're describing,you're doing a binary or CRC comparison when you do "Compare Contents" command, and BC is correctly detecting that the files are not identical. When you open them in the file viewer it does a smarter rules-based comparison, which accounts for things like differences in file encoding and line endings, allowing them to be shown as matches. To get that behavior in the folder view, when you do the "Content Compare" command, change the radio button under "Action" to "Rules-based comparison". If you aren't getting a dialog when you use the command, you can re-enable it in the Options dialog, under "File Operations", with the "Confirm content compare" checkbox.