Altova DiffDog Server 2024 

Running Comparisons

Home Prev Top Next

To compare only local files or directories, supply them as arguments to the diff command. In this case, if you supply two arguments (for example, two file paths) to the diff command, the arguments will be interpreted in the following order: left side of the comparison, right side of the comparison.

 

<executable> diff file1.txt file2.txt --mode=text

 

If you specify three arguments, a three-way comparison takes place, and the arguments are interpreted in this order: left side of the comparison, middle side, and then right side.

 

<executable> diff file1.xml file2.xml file3.xml --mode=xml

 

Note:While not mandatory, for best results it is recommended to explicitly set the --mode option to either text, binary, or xml. Otherwise, the application would need to determine automatically whether you are comparing files or directories, which may lead to undesired results. In the first example above, the comparison mode is set to text since two text files are being compared. In the second example, it is set to xml since three XML files are being compared.

 

Alternatively, you can specify the left and right side of the comparison through options instead of arguments. For example, the command below compares two XML files on the machine where DiffDog Client runs, and both file paths are supplied as options (not arguments):

 

<executable> diff --client-left=file1.xml --client-right=file2.xml

 

When the comparison paths are set as options, you can compare not only files local to the client machine, but also remote files on the machine where DiffDog Server runs. For example, the command below compares two text files where the left one is on the client and the right one is on the server.

 

<executable> diff --client-left=file1.txt --server-right=file2.txt

 

Note:The path syntax must be valid for the operating system where the file is. For example, if the client runs on Windows and the server runs on Linux, then a Windows-style path must be used for --client-left. Conversely, a Linux-style path must be used for --server-right.

 

To perform a three-way comparison, add a third option (either --client-middle or --server-middle, depending on where the common ancestor file is). In the example below, the common ancestor file file2.csv is on the server machine while the left and right files (file1.csv, file3.csv) are on the client machine.

 

<executable> diff --client-left=file1.csv --server-middle=file2.csv --client-right=file3.csv

 

If the server administrator has restricted access to server paths for security reasons, you can no longer run comparisons that refer server file paths directly, see also Restricting Access to Server Paths. Instead, you need to specify the name of an alias by means of the --alias option.

 

For example, the command below compares a file on the client with a file on the server. It is assumed that an alias called "public" has already been defined by an administrator on the server.

 

<executable> diff --client-left=file1.txt --server-right=file2.txt --mode=text --alias=public

 

To query the list of aliases defined on the server, run the aliases command. To save an alias as default, set the server-alias option in the Client Configuration File. This way, you will no longer need to specify an alias at the command line.

 

Note:Alias names are case-sensitive.

© 2018-2024 Altova GmbH