# Comparing Folders Compare two directory trees with GroupDocs.Comparison for .NET to detect added, deleted, or modified files and folders — outputs an HTML or PDF summary report. [GroupDocs.Comparison](https://products.groupdocs.com/comparison/net) allows you to compare the contents of a folder (directory), process and save the result of processing. The steps for _starting the comparison_ and _configuring_ the display of the processing result in the resulting file are described below. 1. Instantiate the [CompareOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/compareoptions) object. 1. Set the `DirectoryCompare` property to `true`. 1. If needed, set the `setFolderComparisonExtension` property to change the output format to `HTML`. By default the format is `TXT`. 1. If needed, set the`ShowOnlyChanged` property to `true` to display only changed items. 2. Initialize the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) object. Specify the path to the first compared folder and the `CompareOptions` object. 3. Call the [Add](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/add/#add_*) method of the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) object. Specify a path to the second folder and the `CompareOptions` object. 4. Call the [Compare](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/compare/#compare) method of the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) object. Specify a path to save the compare results and the [CompareOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/compareoptions) object. The following code snippet shows how to compare the `SourceFolder` and `TargetFolder` folders: {{< tabs "example1">}} {{< tab ".NET" >}} ```cs using System; using GroupDocs.Comparison; using GroupDocs.Comparison.Options; class YoursProgram { static void Main(string[] args) { CompareOptions compareOptions = new CompareOptions { DirectoryCompare = true, }; Comparer comparer = new Comparer("C:\\SourceFolder", compareOptions); comparer.Add("C:\\TargetFolder", compareOptions); comparer.Compare("C:\\Folder_to_save_result\\", compareOptions); } } ``` {{< /tab >}} {{< /tabs >}} The following images show the comparison result: | Result in HTML | Result in TXT | | -------------------------------------------------------------- | ------------------------------------------------------------- | | ![](https://docs.groupdocs.com/comparison/net/images/result-comparison-folders-html.png) | ![](https://docs.groupdocs.com/comparison/net/images/result-comparison-folders-txt.png) | ## See also - [Compare documents]({{< ref "comparison/net/comparison-basic/compare-documents.md" >}}) - [Supported file formats]({{< ref "comparison/net/getting-started/supported-document-formats.md" >}})