WiseCleaner Think Tank

Encounter difficult computer problems?
All about maintenance and optimization of your Windows System.

Home > Think Tank > How to Compare Two Folders in Windows 11

How to Compare Two Folders in Windows 11

Apr 30, 2024

In our daily work, we will contact a large number of files through the folder to categorize the storage. Many times, we need to compare folders as a way to ensure data consistency and track file changes. In this article, I will show you how to compare folders in Windows 11.

Method 1: Compare two folders by Properties

The easiest way to compare two folders is through folder properties. This allows you to quickly see the differences in basic information about the folder, such as size, number of files, location, creation date, etc.

Step 1: Open the Properties window of the folders

Locate the first folder, right-click on it, and select Properties. Keep the Properties window open and perform the same steps for the second folder.

Step 2: Compare the two folders

Drag and drop the Properties windows of the two folders side by side so you can visually compare their differences.

Method 2: Compare two folders by Command Prompt

The method of roughly comparing folders has just been described, but it won't work if you want to compare the differences in the contents of two folders in detail. Therefore, in this case you can use the Command Prompt to check the main differences between the two folders.

Step 1: Copy the folder path

Right-click on the first folder, select Copy as path and note it down. Repeat this for the second folder to be compared.

Step 2: Open the Command Prompt

In the Start menu, search for Command Prompt and run it as an administrator.

Step 3: Type the command

At the Command Prompt, type the following command.

robocopy "First folder path" "Second folder path" /L /NJH /NJS /NP /NS

For example:

robocopy "C:\Users\YNZQ-02\Desktop\folder1" "C:\Users\YNZQ-02\Desktop\folder2" /L /NJH /NJS /NP /NS

After entering the above command, it will show the difference between the two folders.

The parameters here are explained below:

*EXTRA File: Present in the second folder, not the first folder.

New File: Present in the first folder, not the second folder.

Older: Same file in both folders, but the creation date of the file in the first folder is older than the same file in the second folder.

Newer: Same file in both folders, but the creation date of the file in the first folder is later than the same file in the second folder.

Method 3: Compare two folders by PowerShell

In Windows, you can also use PowerShell to compare folders, which provides more flexibility and detailed comparison information.

Step 1: Open the PowerShell

In the Start menu, search for PowerShell and run it as an administrator.

Step 2: Type the command

At the PowerShell, enter the below command.

$fso = Get-ChildItem -Recurse -path "C:\Users\YNZQ-02\Desktop\folder1"

Note: replace "C:\Users\YNZQ-02\Desktop\folder1" with first folder’s path in the above command.

$fsoBU = Get-ChildItem -Recurse -path "C:\Users\YNZQ-02\Desktop\folder2"

Note: replace "C:\Users\YNZQ-02\Desktop\folder2" with second folder’s path in the above command.

Compare-Object -ReferenceObject $fso -DifferenceObject $fsoBU

After you execute the command, PowerShell displays the differences between the two folders.

The parameters here are explained below:

SideIndicator <= shows the file only appears in the first folder.

SideIndicator => shows the file only appears in the second folder.

Conclusion

Comparing two folders in Windows 11 is a simple and effective way to recognize the differences between them. With this guide, you will be able to easily compare two folders in Windows 11.

10