File Compare (Data Management Tools)
Summary
Compares two files and returns the comparison results.
Usage
This tool returns messages showing the comparison result. By default, the tool will stop running after encountering the first difference between the inputs. To report all differences, check the Continue Comparison parameter.
If the differences reported between the input datasets are due to the addition or deletion of records, only the first reported difference is valid. All reported differences after the addition or deletion will be due to the comparison being out of sequence. The compare tools do not attempt to find the next set of matching records after an added or deleted record is encountered.
This tool can report differences between two ASCII files or two binary files
This tool supports masking of characters, words, and lines of text in an ASCII file. For example, two files may be identical except that they contain text representing the date and time of creation. This difference would result in a miscompare. In addition, small variations occur in the way that each platform stores or manipulates numbers. This leads to differences in numeric precision among platforms. To handle false character comparisons, this tool provides several masking capabilities. Before comparing new text files with existing base files, edit the base files to include these special masking symbols.
"#"—Wherever the "#" symbol appears in the input base file, the corresponding character in the input test file will be ignored.
Base: Y delta = 9048.6# Test: Y delta = 9048.61"??"—To mask out an entire word, add "??" at the beginning of the word.
Base: Processing ??ESRI1/ARCIGDS/TESTRUN/CONV/ARCIGDS/CPXSHAPE.DGN Test: Processing ESRI2/ARCIGDS/TESTRUN/CONV/ARCIGDS/CPXSHAPE2.DGN"?!"—A single token may have a period (.) imbedded in it. For example, for the name of a file with an extension of streetnames.dbf, there may be instances where you want part of the name, either before or after the period (.), to be ignored in the comparison of the token.
Base: Master table is: streetnames?!.dbf Test: Master table is: streetnames"???"—Mask the entire line following the ??? characters.
Base: ??? 8 4 1 0 14 10 Test: 12 8 2 1 16 12
ASCII is the default file type. When using binary files as input, change the File Type parameter to Binary.
When there is a miscompare between ASCII files, the tool will report differences, such as the total number of characters that are different and the differences for each line.
When there is a miscompare between binary files, the tool will report that the file sizes are different and report the differences for each byte.
The Output Compare File parameter value will contain all similarities and differences between the Input Base File and the Input Test File parameter values. This file is a comma-delimited text file that can be viewed and used as a table in ArcGIS.
When using this tool in Python, get the status of the comparison from the returned
Resultobject using the index position of 1.(result[1]). The value will be'true'when no differences are found and'false'when differences are found.
Parameters
| Label | Explanation | Data type |
|---|---|---|
|
Input Base File |
The file that will be compared with the Input Test File parameter value. This parameter value is a file that you have declared valid. This base file has the correct content and information. |
File |
|
Input Test File |
The file that will be compared with the Input Base File parameter value. This parameter value is a file that you have made changes to by editing or compiling new information. |
File |
|
File Type (Optional) |
Specifies the type of comparison that will be used for the files.
|
String |
|
Continue Comparison (Optional) |
Specifies whether the comparison will continue after encountering the first difference between the inputs.
|
Boolean |
|
Output Compare File (Optional) |
The output file that will contain all similarities and differences between the inputs. This file is a comma-delimited text file that can be viewed and used as a table in ArcGIS. The output file that will contain all similarities and differences between the inputs. This file is a comma-delimited text file that can be viewed and used as a table in ArcGIS. |
File |
Derived output
| Label | Explanation | Data type |
|---|---|---|
|
Compare Status |
The compare status will be |
Boolean |
Environments
This tool does not use any geoprocessing environments.
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes