Altova DiffDog Server 2023 

For directories, you can view the comparison result in either text or XML format, by setting the --output-mode=text, or --output-mode=xml, respectively. The --output-mode option lets you specify the format of the comparison report (text or XML), while the --output-file option lets you specify the name of the report file.


The option --output-mode=text is not supported if the compared directories include XML files, and if --dir-compare-contents=true. The result of comparing XML files can be reported only in XML format.


To understand how DiffDog Server reports differences between directories, let's assume that the following two directories must be compared side-by-side.



|-- documents/

|-- Don Quixote.txt

|-- Metamorphosis.txt


|-- Don Quixote.txt

|-- img1.png

|-- Metamorphosis.txt




When compared with a graphical differencing tool like DiffDog (using the quick comparison mode), the differences between the two directories are represented as shown below. As shown below, the sub-directory documents was deleted and the file img1.png was added in the right directory. Also, the file Metamorphosis.txt has a different modification time.


DiffDog comparison report

In DiffDog Server, you can run a quick comparison between these two directories with the command:


<exec> diff dir1 dir2 --output-mode=text --output-file=report.txt --dir-compare-sizes=true --dir-compare-mod-times=true


Note:The comparison above is also "quick" because no directory contents were compared, only the size and modification date of files inside the two directories. To perform a thorough comparison which also takes the file contents into account, add the option --dir-compare-contents=true.


In the text report produced after running the comparison, the differences are reported as follows:


< documents/

! Metamorphosis.txt

> img1.png

DiffDog Server comparison report (text)

The "<" character indicates the left side of the comparison, while the ">" character indicates the right side. The trailing forward slash denotes a directory (as opposed to a file). The "!" character indicates differences in the corresponding file.


Like with file reports, the information above should be interpreted as instructions that one should follow to make both directories equal. In this example, the instructions must be understood as follows:


1.Add the documents sub-directory in the "left" directory

2.Copy the Metamorphosis.txt file either from left to right directory, or vice versa.

3.Add the img1.png file to the "right" directory.


Note:The verb "add" must be changed to "delete" depending on the intended merge direction. In this example, to merge changes from left to right, the first instruction is "add" and the second is "delete". If the merge direction is from right to left, the first instruction is "delete" and the second instruction is "add".


XML report

Let's now run the same comparison, and change only the format of the report file from text to XML. In other words, the differencing command has now become:


<exec> diff dir1 dir2 --output-mode=xml --output-file=report.xml --dir-compare-sizes=true --dir-compare-mod-times=true


In the XML report produced after running the comparison, the differences are reported as follows:


<?xml version="1.0" encoding="UTF-8"?>
<!-- Differencing export generated by Altova DiffDog Server -->
  <diff_info comparison_mode="quick">
    <source_left name="c:\dir1" uri="file:///c:/dir1"/>
    <source_right name="c:\dir2" uri="file:///c:/dir2"/>
  <file_diff location="">
        <directory name="documents"/>
        <file name="Metamorphosis.txt"/>
        <file name="img1.png"/>

DiffDog Server comparison report (XML)

The diff_info element supplies information about directories that were compared (including the comparison mode used, and the path of the compared files). This element occurs only once.


In directory comparison reports, the file_diff element occurs only once. It can have multiple occurrences of any of the following child elements: left_content, changed_content, and right_content. These are equivalents of "<", ">", and "!" in text reports and have the same meaning as mentioned above.

© 2016-2022 Altova GmbH