Show Navigation | Hide Navigation

File Compare (Data Management)

Release 9.2
Last modified November 29, 2010
E-mail This Topic Printable Version Give Us Feedback


Related Topics

Compares two files and returns the comparison results. File Compare can report differences between two ascii files or two binary files.


Usage tips

Command line syntax
An overview of the Command Line window
FileCompare_management <in_base_file> <in_test_file> {ASCII | BINARY} {NO_CONTINUE_COMPARE | CONTINUE_COMPARE} {out_compare_file}

Parameter Explanation Data Type
<in_base_file>

The Input Base File is compared with the Input Test File. The Input Base File refers to your file that you have declared valid. This base file has the correct content and information.

File
<in_test_file>

The Input Test File is compared against the Input Base File. The Input Test File refers to your file that you have made changes by editing or compiling new information.

File
{ASCII | BINARY}

The type of files being compared. The file types are ASCII and BINARY. ASCII is the default.

  • ASCII
  • BINARY

String
{NO_CONTINUE_COMPARE | CONTINUE_COMPARE}

Indicates whether to compare all properties after encountering the first mismatch.

  • NO_CONTINUE_COMPARE — Stop after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARE — Compare other properties after encountering the first mismatch.

Boolean
{out_compare_file}

This file will contain all similarities and differences between the Input Base File and the Input Test File. This file is a comma delimited text file which can be viewed and used as a table in ArcGIS.

File
Data types for geoprocessing tool parameters


Command line example

FileCompare_management c:\workspace\well_xycoordinates.txt c:\workspace\new_well_xycoordinates.txt ASCII CONTINUE_COMPARE C:\workspace\well_file_compare.txt

Scripting syntax
About getting started with writing geoprocessing scripts
FileCompare_management (in_base_file, in_test_file, file_type, continue_compare, out_compare_file)

Parameter Explanation Data Type
in_base_file (Required)

The Input Base File is compared with the Input Test File. The Input Base File refers to your file that you have declared valid. This base file has the correct content and information.

File
in_test_file (Required)

The Input Test File is compared against the Input Base File. The Input Test File refers to your file that you have made changes by editing or compiling new information.

File
file_type (Optional)

The type of files being compared. The file types are ASCII and BINARY. ASCII is the default.

  • ASCII
  • BINARY

String
continue_compare (Optional)

Indicates whether to compare all properties after encountering the first mismatch.

  • NO_CONTINUE_COMPARE — Stop after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARE — Compare other properties after encountering the first mismatch.

Boolean
out_compare_file (Optional)

This file will contain all similarities and differences between the Input Base File and the Input Test File. This file is a comma delimited text file which can be viewed and used as a table in ArcGIS.

File

Data types for geoprocessing tool parameters


Script example

# FileCompare.py
# Description: Compare two text files and return comparison result.
# Requirements: None
# Author: ESRI
# Date: 06/21/05

# Create the Geoprocessing Object
import arcgisscripting, sys, os
gp = arcgisscripting.create()

try:
    # Set local variables
    base_file= "C:/Workspace/well_xycoordinates.txt"
    test_file= "C:/Workspace/new_well_coordinates.txt"
    file_type = "ASCII"
    continue_compare = "CONTINUE_COMPARE"
    compare_file = "C:/Workspace/well_file_compare.txt"

    # Process: FeatureCompare
    compare_result = gp.FileCompare_management(base_file, test_features, file_type, continue_compare, compare_file)
    print compare_result
    print gp.GetMessages()

except:
    # Print error message if an error occurs
    print gp.GetMessages()

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.