
How to Compare the Contents of Two Folders in Windows? winhelponline.com/blog/compare-two-directories-files-find-differences August 9, 2016 Let’s assume you made a backup task using Robocopy, XCopy, SyncToy or any other tool to mirror copy a certain directory to a different location. Especially if you’re using Microsoft SyncToy, sometimes files or folders may be missing in the destination, or the destination folder has extra files or folders that are not in the source folder. Here is how to compare the directory structure (along with files) in two different directory paths to make sure you have an exact replica or mirror copy of the source. Many of the methods below also discuss how to synchronize items in two folders after comparing. Contents Compare the contents of two folders using Microsoft’s WinDiff WinDiff is a graphical file comparison tool from Microsoft which was first released in the year 1992 and subsequently updated. Please hold on! Don’t be taken aback by the year of the initial release. WinDiff is still awesome and it works perfectly fine in Windows 10, but no Unicode support. It has enormous potential. WinDiff can compare ASCII & Binary files, compare two directories, and synchronize the folders (left folder → right folder, or vice-versa). 1/23 You can download WinDiff as part of the Windows XP Support Tools package. Alternate WinDiff download link (third-party mirror). The last updated WinDiff version is 5.2.3790.0 with the Date modified stamp showing 4-7-2016. To do a directory comparison using WinDiff: 1. Start Windiff.exe. 2. On the File menu, click Compare Directories. 3. In the Select Directories dialog box, type the two folder names that you want to compare in the Dir1 and Dir2 boxes. If you want to compare files in those folders recursively, enable the Include subdirectories checkbox. The results or the outline window by default shows identical files as well as the differences. You can hide identical files by disabling Show Identical Files from the Options menu. As you can see, WinDiff is not just comparing file names but also compares file contents in both locations and highlights changes if the file contents are different. 2/23 Double-clicking on the “different” item opens the comparison view with color-coding. The color-coded results indicate what the file differences are. WinDiff can do ASCII and binary comparison. This means, WinDiff doesn’t rely upon modified date but compares the actual contents of the files. For example, I modified a character in a text file in the destination folder (Right folder). I replaced an exclamation mark with a colon, and the file size is exactly the same (1,127 bytes) in both locations. WinDiff picked it up and showed that the files are different. To save the directory comparison differences to a file, click Save File List in the File Menu. Type a file name with complete path without double-quotes. Uncheck Identical files and Include Checksums options, and click OK. The output file will look like this: 3/23 -- D:\Websites\Winhelponline\blog\wp-content\uploads\2019 : E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp-content\uploads\2019 -- includes left-only,right-only,differing files .\accesschk.exe only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\compare-folders.txt only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\fta-1803-w10.txt only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\ssh-commands-useful.txt only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\05\dell-supportassist.png only in D:\Websites\Winhelponline\blog\wp-content\uploads\2019 .\05\disable-theme-sync-ramesh.png different (E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp-content\uploads\2019 is more recent) .\05\file-explorer-not-highlight-files.png only in D:\Websites\Winhelponline\blog\wp-content\uploads\2019 .\05\firefox-forget-about-this-site-4.png different (E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp-content\uploads\2019 is more recent) .\05\msconfig-disable-services-non-microsoft.png only in D:\Websites\Winhelponline\blog\wp- content\uploads\2019 .\05\windows-store-error-0x800706d9.png only in D:\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\notepad-bing-search.png only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\rundll32-refresh-commands.txt only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\archives\404chk.vbs only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\archives\actxprxy-missing-issues.txt only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp-content\uploads\2019 .\06\archives\apps.png only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\archives\articles.vbs only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 .\06\archives\bash-sh.vbs only in E:\RameshPC-Synced Backup\Websites\Winhelponline\blog\wp- content\uploads\2019 -- 17 files listed Since the output file is in tab-delimited format, you should be able to import into Microsoft Office Excel or easily. 4/23 Note that you can start WinDiff directly with source and destination paths as additional switches for directory comparison. For example, launching windiff.exe "c:\source" "d:\destination" would launch the tool and straight away compare those two folder paths. WinDiff command-line switches Here is the complete list of WinDiff command-line switches. 5/23 Usage: windiff [options] path1 [path2] Options: -D Compare one directory only. -F[flags] savefile Save composite file to 'savefile'. The 'flags' may consist of one or more of I (identical), L (left), R (right), F (moved leFt), G (moved riGht), S (Similar left), A (similiAr right), X (exit after saving list). (e.g. -FLF saves list of Left or moved-leFt lines). -I file Reads list of files to compare, from the specified input file. Each line can contain one or two filenames, space delimited (with quoting, if filenames contain spaces). Use "-" as the filename to read from stdin. If a line contains only one filename, the file is compared to itself. -N name NET SEND notification to 'name' at end of comparison. -O Outline view (no automatic expansion). -P Perverse comparison: breaks lines on punctuation. -S[flags] savefile Save list of files to 'savefile'. The 'flags' may consist of one or more of S (same), L (left), R (right), D (different), X (exit after saving list). (e.g. -SLD saves list of Left or Different files). -T Compare whole subtree. To save the comparison report to a file using the -S switch. Examples are below: Save the list of identical files to diff.txt: -SS D:\output\diff.txt c:\folder1 d:\folder2 Save the list of different files to diff.txt: -SD D:\output\diff.txt c:\folder1 d:\folder2 Save the list of left-only files to diff.txt: -SL D:\output\diff.txt c:\folder1 d:\folder2 Saves the list of right-only files to diff.txt: -SR D:\output\diff.txt c:\folder1 d:\folder2 Saves the list of left-only AND right-only files to diff.txt: -SLR D:\output\diff.txt c:\folder1 d:\folder2 To exit WinDiff automatically after saving the comparison report, add the X switch, as below: Save the list of right-only files to diff.txt and exit WinDiff -SRX D:\output\diff.txt c:\folder1 d:\folder2 6/23 Save the list of left-only AND right-only files to diff.txt and exit WinDiff -SLRX D:\output\diff.txt c:\folder1 d:\folder2 To generate all 5 individual “log” files you would have to run WinDiff 5 times. Example: windiff -SSX identical.txt c:\folder1 d:\folder2 windiff -SDX different.txt c:\folder1 d:\folder2 windiff -SLX left-only.txt c:\folder1 d:\folder2 windiff -SRX right-only.txt c:\folder1 d:\folder2 windiff -SLRX left-right-only.txt c:\folder1 d:\folder2 See also WinDiff Help File Contents (windiff.hlp) in HTML format. Sync folders with WinDiff What’s more? WinDiff can also copy the missing or different files to the left (Folder 1) or to the right (Folder 2) location. To do so, 1. From the File menu, select Copy Files 2. Type the folder path where you want to copy the missing/different files. Important: Don’t use double-quotes around the folder path even if the folder path contains spaces. WinDiff fails to copy files if you adding double-quotes to the path. 3. Choose the Copy from location (Left tree to Right tree, or vice-versa) 4. Uncheck Identical Files, and click OK. WinDiff now syncs the folder by copying the missing and changed files recursively to the specified location (Left → Right). 7/23 Despite the excellent ASCII & binary comparison and basic sync capabilities, WinDiff is often an underrated tool among IT folks. That’s because it sports an outdated user interface and has no Unicode support. But WinDiff is enough for most of us, especially those who use the English language OS. Microsoft has a knowledgebase article on WinDiff, titled How to Use the Windiff.exe Utility which you may want to check out. Compare the contents of two folders using WinMerge Here is how to compare two folders along with sub-folders, using WinMerge. WinMerge is an Open Source differencing and merging tool for Windows. It can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle. Let’s use it to compare the contents of two folders along with their sub-folders (i.e., recursively).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages23 Page
-
File Size-