Last active
November 30, 2025 03:55
-
-
Save milnak/e5e98ecf50eff4a92dbb8e0213500626 to your computer and use it in GitHub Desktop.
md5sum check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $md5sum = Get-Content '.\test.md5' | Select-String -Pattern '^([0-9a-fA-F]+) ([ \*])(.+)' | ForEach-Object { $hash,$binary, $path = $_.Matches[0].Groups[1..3].Value; [PSCustomObject] @{Hash=$hash; Binary=[Bool]($binary -eq '*'); Path=$path } } | |
| $md5sum | ForEach-Object { if ($_.Hash.ToLower() -eq (Get-FileHash $_.Path -Algorithm MD5 -ErrorAction SilentlyContinue -ErrorVariable HashError).Hash) { "$($_.Path): OK" } else { if ($HashError) { "$HashError`n$($_.Path): FAILED open or read" } else { "$($_.Path): FAILED" } } } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
differences:
original md5sum has different error output, e.g.
e:\bin\md5sum.exe: ..\file.bin: No such file or directoryoriginal reports summaries: