Last active
June 7, 2020 02:36
-
-
Save hube/951e807cb9ebec4dda72e5ca3c0a0135 to your computer and use it in GitHub Desktop.
Compare the files of two directories using content hashes
This file contains 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
$referencePath = "a" | |
$differencePath = "b" | |
$lhs = Get-ChildItem -Recurse -File -Path $referencePath | |
$lhs_hashes = $lhs | Select-Object Name, FullName, Length, @{Name="Hash"; Expression={ Get-FileHash $_.FullName }} | |
$rhs = Get-ChildItem -Recurse -File -Path $differencePath | |
$rhs_hashes = $rhs | Select-Object Name, FullName, Length, @{Name="Hash"; Expression={ Get-FileHash $_.FullName }} | |
$diff = Compare-Object $lhs_hashes $rhs_hashes -property @("Name", "Hash") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment