I am searching for a solution for the following situation. I have a list of Hashes in a Text File and i want to find every File in a certain folder and subfolders that matches the Hashes from the Text File.

The found Files will be listed as a Result and i would love to be abel to delete (or maybe move or copy) those found files...

Is there any easy (software tool) way to do this ? Or does someone have a workaround ?

Thanks in Advance

  • In order to "match" a MD5 hash to a file, you would have to provide the same input that generated the MD5 hash originally, since you cannot reverse the MD5 hash into a filename. Do you know how the MD5 was generated? Assuming you know that information what have you attempted? Generating an MD5 hash is relatively simply with PowerShell. However, in order to "prettify" the output, the more complex the script can become.
    – Ramhound
    Jul 6, 2021 at 18:56
  • i dont know if i understand you correctly...i have no interest in the filenames whatsoever so basically i want a tool that hashes all MY files and compares those hashes to the ones in my txt file and if they match list it to me otherwise ignore my file. I am well aware this will take some time.
    – Sev
    Jul 6, 2021 at 19:08
  • You would have to write a tool that does what you describe. I mention filenames because MD5 only takes text input. I will repeat for your benefit you would have to provide it the same input to generate the same MD5 hashes. It does not sound like you know how the MD5 hashes in your input file were generated.
    – Ramhound
    Jul 6, 2021 at 19:17
  • You can use a BASH script. Create the MD5 hashes of all files in your folders and then compare them to your list. Then take action on matches.
    – zx485
    Jul 7, 2021 at 23:25
  • @zx485 yeah i kinda hoped theres a software for that already :D thanks thou
    – Sev
    Jul 31, 2021 at 12:07

1 Answer 1


I realize how old this question is, but I was looking for the answer and when I didn't find it here, I came up with this powershell script:

#you can change this hashAlgorithm to be any of the following
# SHA1 | SHA256 | SHA384 | SHA512 | MACTripleDES | MD5 | RIPEMD160
$hashAlgorithm = "MD5"

#you can change this to point to the folder containing all of your files
$sourceFolder = "C:\Users\Public\Documents\my-files\"

#the name of the file containing all of your hashes
$hashesFile = "MD5SUMS"

$hashesFilePath = ($sourceFolder + $hashesFile)

Get-ChildItem $sourceFolder -Recurse -Exclude $hashesFilePath -Attributes !Directory |
ForEach-Object {
    $currentHash = Get-FileHash $_.FullName -Algorithm $hashAlgorithm | Select -ExpandProperty "Hash"
    If (Select-String $hashesFilePath -pattern $currentHash -quiet)
        echo ("Matching hash for " + $_.FullName)
    } Else {
        echo ("Hash not found for " + $_.FullName)

This should get you going. It's not super-robust for things like the possibility that more than one file may contain the same exact content - that just isn't handled in this simple script. E.g., if you have an empty file that is represented in your MD5SUMS file, then when any other file that is empty has its calculation done... this script will show a match found.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .