GroupDocs.Comparison for Python via .NET can compare two folders, surface which files were added, deleted, or modified, and produce either a TXT or HTML report.
Steps:
Instantiate CompareOptions.
Set directory_compare = True.
Optionally set folder_comparison_extension to FolderComparisonExtension.HTML for an HTML report (the default is TXT).
Optionally set show_only_changed = True to filter out unchanged items.
Create Comparer with the source folder path and the CompareOptions.
Call add() with the target folder and the same CompareOptions.
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.
fromgroupdocs.comparisonimportComparerfromgroupdocs.comparison.optionsimportCompareOptions,FolderComparisonExtensiondefcompare_folders():compare_options=CompareOptions()compare_options.directory_compare=Truecompare_options.folder_comparison_extension=FolderComparisonExtension.HTMLcompare_options.show_only_changed=TruewithComparer("SourceFolder",compare_options)ascomparer: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()