Best way to do a hash compare of 2 folders

  1. Posts : 283
    Win 10 Pro x64

    Best way to do a hash compare of 2 folders

    So I have two folders. The first folder has duplicate files that exist in the second folder. The problem is that in the second folder, the files are named very differently. Is there a way to do a hash compare of both folders, and then for it to tell me which files there is duplicates for in both folders, and which files there are not?
      My Computer

  2. Posts : 809

    Here's a quick Powershell script:

    function DoFolderHash([string]$folder1, [string]$folder2)
      $hashes1 = Get-ChildItem -Path "$folder1" -Recurse | Get-FileHash
      $hashes2 = Get-ChildItem -Path "$folder2" -Recurse | Get-FileHash
      $files = $hashes1.Path + $hashes2.Path
      "Identical files:"
      foreach($h1 in $hashes1)
        foreach($h2 in $hashes2)
          if($h1.Hash -eq $h2.Hash)
            $h1.Path + " == " + $h2.Path
            $files = $files -ne $h1.Path
            $files = $files -ne $h2.Path
      "Unique files:"
    Copy+paste it into a Powershell window and run DoFolderHash <Folder 1> <Folder 2>

    PS C:\Users\Me> DoFolderHash "c:\temp\1" "c:\temp\2"
    Identical files:
    C:\temp\1\HxD32.exe == C:\temp\2\a
    C:\temp\1\HxD32.exe == C:\temp\2\e
    C:\temp\1\HxD64.exe == C:\temp\2\g
    C:\temp\1\readme.txt == C:\temp\2\f
    C:\temp\1\Settings\HxD Hex Editor.ini == C:\temp\2\b
    C:\temp\1\Settings\HxD Hex Editor.lang == C:\temp\2\c
    Unique files:
    PS C:\Users\Me>
      My Computer

  3. Posts : 43,371
    Win 10 Pro (22H2) (2nd PC is 22H2)

    This program can..
    Best way to do a hash compare of 2 folders-1.jpg

    - that's shareware..

    Verify files in two directories with Checksum Compare - gHacks Tech News
    - but doesn't recurse if folders are nested.

    Screenshots of Quickhash running on Windows, Linux and Apple Mac OSX | QuickHash GUI
    - this shows a screenshot of contents of two folders listed and compared as one of its functions.
      My Computers

  4. Posts : 283
    Win 10 Pro x64
    Thread Starter

    Thanks all! I'll check both of these out.
      My Computer


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:07.
Find Us

Windows 10 Forums