# Compare Folders Compare two folders to detect added, deleted, and modified files using the directory_compare option of GroupDocs.Comparison for Python via .NET. [GroupDocs.Comparison for Python via .NET](https://products.groupdocs.com/comparison/python-net) can compare two folders, surface which files were added, deleted, or modified, and produce either a `TXT` or `HTML` report. Steps: 1. Instantiate `CompareOptions`. 2. Set `directory_compare = True`. 3. Optionally set `folder_comparison_extension` to `FolderComparisonExtension.HTML` for an HTML report (the default is TXT). 4. Optionally set `show_only_changed = True` to filter out unchanged items. 5. Create `Comparer` with the source folder path and the `CompareOptions`. 6. Call `add()` with the target folder and the same `CompareOptions`. 7. Call `compare_directory()` with the result file path and the `CompareOptions`. ## Example: Compare two folders The example below uses the bare folder names `SourceFolder` and `TargetFolder` rather than `./SourceFolder` so that the example-runner can detect them as shared sample directories. In your own code you can use any absolute or relative path — `./source-folder`, `/home/me/projects/src`, etc. {{< tabs "compare-folders">}} {{< tab "compare_folders.py" >}} ```python from groupdocs.comparison import Comparer from groupdocs.comparison.options import CompareOptions, FolderComparisonExtension def compare_folders(): compare_options = CompareOptions() compare_options.directory_compare = True compare_options.folder_comparison_extension = FolderComparisonExtension.HTML compare_options.show_only_changed = True with Comparer("SourceFolder", compare_options) as comparer: comparer.add("TargetFolder", compare_options) comparer.compare_directory("./result.html", compare_options) print("Folders compared successfully. Check output in result.html.") if __name__ == "__main__": compare_folders() ``` {{< /tab >}} {{< tab "result.htmlResult.html" >}} ```text