Altova DiffDog Server 2022 

Comparing Directories

Home Prev Top Next

To compare two local directories side-by-side, call the diff command and supply the directory paths as arguments, for example:


<exec> diff "C:\Reports" "C:\ReportsNew"


The example above runs a quick but not exact comparison (which would report just the new or missing files in both directories). This is because the option --dir-compare-contents was not specified, so the default value false is assumed.


To run a deep comparison which would also check the contents of all files and sub-directories within the compared directories, set the --dir-compare-contents=true, for example:


<exec> diff "C:\Reports" "C:\ReportsNew" --dir-compare-contents=true --mode=auto


If both directories contains files of similar type, you might want to set the --mode option to indicate which comparison mode you would like to use, for example, --mode=binary, --mode=text, or --mode=xml. Otherwise, set --mode=auto, like in the example above. In this mode, the program will compare directory files according to their extension.


Like other comparison kinds, the compared directories can be either on the server or on the client machine. To specify if the directories are on the server or on the client, set the --server-left, --server-right or --client-left, --client-right options. For example, in the comparison below, the first directory is on the server and the second one is on the client machine:


<exec> diff --server-left="/home/altova/reports" --client-right="C:\ReportsNew"


There are various other options applicable to directories that you can set at the command line, namely:


--directory-filter, --df lets you include or exclude certain files or sub-directories from the comparison based on criteria you define.

--dir-compare-mod-times, --dt adds as comparison criterion the time when the compared directories or files were last modified.

--dir-compare-mod-times-ignore-seconds, --di when comparing modification times (see previous option), this option ignores file or directory modifications made within the specified number of seconds.

--dir-compare-sizes, --ds adds the directory size as comparison criterion.

--dir-ignore-case, --dic ignores case in file and directory names

--output-file, --o lets you set the name of the report file (text or XML) where the comparison results will be saved.

--output-mode, --om lets you choose a format for the comparison report (XML or text).


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.


In addition, when --dir-compare-contents=true, you can use all the file comparison options (such as those that begin with --doc, --text, or, --xml, see the diff command reference). For example, if directories containing text files are compared, you can ignore blank lines or case inside the text files with a command like:


<exec> diff "C:\Reports" "C:\ReportsNew" --dir-compare-contents=true --mode=auto --text-ignore-case=true

© 2016-2022 Altova GmbH