Windows

How To Compare Two Folders Windows 10 and Mac

Have you ever encountered a situation where you created a copy of a folder using the mirror feature and saved it in a different directory, the same copy you created went missing? Because, if you have, then you should definitely keep reading further. This scenario can occur in both Windows 10 and mac and is quite infuriating.

In this article, we will discuss and, in detail, all the solutions you can use to compare two folders in Windows and mac and fix this problem.

This article is divided into two portions, so if you want to learn to fix the solution in just Windows or just in mac, you can skip the other one.

How To Compare Two Folders in Windows 10

Here are all the solutions you can use to compare two folders in Windows 10. All of these solutions are explained with step-by-step instructions.

Solution 1: Using PowerShell

The PowerShell method is one of the easiest ways to compare two folders in Windows 10. However, using this method, you can only compare the file names of the folders.

Step 1: Open The Windows PowerShell Console

Click on the start menu on the home of Windows 10 and type PowerShell. Then click on Windows PowerShell to open the console.

1N8OhxXPXPE

Step 2: Copy and Paste The Command G

Input the source folder and destination folder in place of source_folder_path and dest_folder_path in the following command and paste the rest of it as it is written.

$Folder1 = “source_folder_path”

$Folder2 = “dest_folder_path”

function Get-Directories ($path)

{

$PathLength = $path.length

Get-ChildItem $path -Recurse | % {

Add-Member -InputObject $_ -MemberType NoteProperty -Name RelativePath -Value $_.FullName.substring($PathLength+1)

$_

}

}

Compare-Object (Get-Directories $Folder1) (Get-Directories $Folder2) -Property RelativePath | Sort RelativePath, Name -desc

Step 3: Compare The Two Files/Folders

The site indicator <= in your output means the folder or file is only present in the source folder.

The site indicator => in your output means the folder or file is present only in the destination folder.

Solution 2: Using WInMerge

To compare two folders on Windows 10 using this solution, you will need WinMerge, which is very easy to get for free. Follow the full step-by-step solution to learn how to get WinMerge and use it to compare two folders.

Step 1: Download and Install WinMerge

You can easily download WinMerge for free from ninite.com. The setup of WinMerge is also small, so you will be able to install it within a few minutes, even on slow internet.

Step 2: Open WinMerge

After the installation process is complete, open WinMerge and click on the folder icon situated on the screen’s top-left corner.

Step 3: Choose The Files/Folders You Want To Compare

Choose the files or folders you want to compare in the right and left sections.

Don’t change anything in the filter section. And check the include subfolders section if you want the subfolders to be included. Then click on ok.

Step 4: See The Difference

You can compare the text difference by clicking on the .txt files.

Step 5: Compare The Two Files/Folders

You can easily compare the two files or folders by monitoring the given comparison results.

15bVhHur5pTleH QjlF3ijw

Solution 3: Using CMD TREE Command

Another way of comparing two directories in Windows 10 is by using the TREE command.

The step-by-step method to compare two folders using TREE is given below:

Step 1: Open Command Prompt

Open the command prompt console from the start menu.

16T7sCdX2ZQu8EhBHSNACzA

Step 2: Copy and Paste These Commands

Copy and paste the given commands into the command prompt.

TREE D:SOURCE /A /F >D:SOURCE.TXT

TREE D:DEST /A /F >D:DEST.TXT

Step 3: Compare The Two Directories

Open WinMerge, and copy and paste the outputs of d:source.txt in left and D:DEST.TXT on right. Then compare the two through comparison results.

Solution 4: Using CMD DIR Command

You can also compare two directories in Windows 10 by using the DIR command. However, the TREE method is far easier than the DIR method because, in the DIR method, you will have to remove the base paths from outputs in Notepad manually.

The step-by-step method to compare two folders using DIR is given below:

Step 1: Open Command Prompt

16T7sCdX2ZQu8EhBHSNACzA

Open the command prompt console from the start menu.

Step 2: Copy And Paste The Commands Given Below

Copy and paste the following commands given below in the command prompt.

DIR D:SOURCE /S /AD /B >D:SOURCE.TXT

DIR D:DEST /S /AD /B >D:DEST.TXT

Step 3: Compare The Directories

Now save the files and put them in WinMerge. In this way, you are going to be able to compare them.

The method to compare directories through WinMerge has already been explained earlier in the article.

How To Compare Two Folders in Mac

For mac, we are going to explain a simple solution that does not require any third-party app, and this feature is actually pre-built in the mac OS.

So, in case you are an all-in mac user and are looking for an easy way to compare two directories, just follow the solution given below, and you will be good to go.

Solution: Using Terminal

Here is the step-by-step solution:

Step 1: Launch Terminal

Go to Applications, then Utilities, and launch Terminal from there.

Step 2: Change The Directory

Now change the directory using the cd command and select the folders or files you want to compare.

After selecting the folders, please copy and paste this command then run it.

diff -rq folder1 folder2

Step 3: Compare The Two Folders

Now diff will tell you which file is different in both the folders so you can compare them.

In this way, you can compare two folders on mac.

Conclusion

You can use the solutions given above to compare two folders on Windows and mac. And by comparing two folders, you can find out about all the missing files from either folder in order to diagnose where the problem is occurring.

We hope these solutions will work out for you. Do let us know your thoughts in the comments.

You may also like

Leave a reply

Your email address will not be published. Required fields are marked *