Beyond Compare

by Frank Perez March 8, 2008

Beyond Compare is one of my favorite developer utilities. It's a tool for comparing folders, files, and folder like things such as ZIP and CAB files. It can detect differences using several methods, such as the timestamp, size, CRC, attributes, and more.


Once two files are identified as not identical, you can drill down into the contents and see exactly what is different line by line using Beyond Compare's File Viewer.


This feature is cool, however the native file viewer only supports text files such as HTML, TXT, XML, and so on. If you try to compare a binary file, you get something that looks like this.


I checked Beyond Compare's web site and found several plug-ins for viewing other binary files like BMP, GIF, JPG, and MP3. Hmm, not what I was looking for, but could be a handy thing to have in the future.


I looked around a little more and I found some file viewer rules for handling binary files like DOC, XLS, and PDF. Once again, not what I needed, but I would probably need some day.

So I decided to download a few of these and what I found is that the file viewer rules use Beyond Compare's capability to launch an external conversion program before a file is passed to it's native file viewer. For example, the DOC rule uses a Visual Basic Script (VBS) to automate Microsoft Word, open the passed DOC file, and then save a copy of it to a temporary text file. This temporary file is then passed to Beyond Compare's internal File Viewer for the line by line comparison.


Bingo! If Beyond Compare can call an external conversion program, why not write something that converts FoxPro files to plain text files. And thus VFP2TEXT was created.

Here's how it works. I created a file viewer rule in Beyond Compare for all FoxPro related file types (CDX, DBC, DBF, DCT, DCX, FPT, FRT, FRX, FXP, H, LBT, LBX, MNT, MNX, MPR, MPX, PJT, PJX, PRG, QPR, SCT, SCX, VCT, VCX). This rule calls executes VFP2TEXT.EXE passing both the original file name and a temporary file name.


Based on the file type, the VFP2TEXT.EXE program converts the passed file to a text file using one of the following methods:

  • Index (CDX, DCX): retrieve the index tag information only.
  • Table (DBF, DBC, FRX, SCX, etc): use the CURSORTOXML() function to generate an XML file.
  • Text (H, MPR, PRG, etc): no conversion.
  • Visual Class Library (VCX): use the Class Browser View Code feature to generate a PRG file.

If you would like a copy of this application, you can download the latest version from http://pfsolutions-mi.com/Product/VFP2Text. When using it, there are a couple of things to keep in mind:

  • Beyond Compare will execute the conversion program twice, once for the file on the left and once for the file on the right.
  • Be careful about doing a Rules-Based Comparison on a large directory. I prefer to use the Binary Comparison first, and then use a Rules-Based Comparison on the results.


Links:
Beyond Compare http://www.scootersoftware.com/

Keywords:

Filed Under: VFP | VFP2Text

Pingbacks and trackbacks (1)+

Comments are closed

About Frank

Frank lives in West Bloomfield, Michigan with his wife and three children.  When he is not writing code, he enjoys long distance running and riding his motorcycle.

Month List

Tag Cloud