Last active
May 3, 2016 23:18
-
-
Save michaellwest/309c6a49ff3946e984a39242353ebc4e to your computer and use it in GitHub Desktop.
Compares the different between two folders.
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
function Compare-Folder { | |
param( | |
[string]$LeftFolder, | |
[string]$RightFolder | |
) | |
$LeftSideHash = Get-ChildItem $LeftFolder -Recurse | Get-FileHash -Algorithm SHA1 | | |
Select-Object @{Label="Path";Expression={$_.Path.Replace($LeftFolder,"")}},Hash | |
$RightSideHash = Get-ChildItem $RightFolder -Recurse | Get-FileHash -Algorithm SHA1 | | |
Select-Object @{Label="Path";Expression={$_.Path.Replace($RightFolder,"")}},Hash | |
Compare-Object $LeftSideHash $RightSideHash -Property Path,Hash | Sort-Object -Property Path | |
} | |
Compare-Folder -LeftFolder "C:\inetpub\wwwroot\Console\Website\App_Config\Include" -RightFolder "C:\inetpub\wwwroot\Console2\Website\App_Config\Include" | |
Compare-Folder -LeftFolder "C:\inetpub\wwwroot\Console\Website\bin" -RightFolder "C:\inetpub\wwwroot\Console2\Website\bin" |
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
Import-Module -Name SPE | |
$folderFilter = "^archive\\|^App_Data\\|^sitecore\\|^sitecore modules\\|^temp\\" | |
$script = { | |
$directory = "$AppPath" | |
Get-ChildItem $directory -Recurse | | |
Where-Object { $_.FullName.Replace($directory,"") -notmatch $using:folderFilter } | | |
Get-FileHash -Algorithm SHA1 | | |
Select-Object @{Label="Path";Expression={$_.Path.Replace($directory,"")}},Hash | |
} | |
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://sctsta.console.com" | |
$leftSide = Invoke-RemoteScript -ScriptBlock $script -Session $session | |
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://sctstd.console.com" | |
$rightSide = Invoke-RemoteScript -ScriptBlock $script -Session $session | |
Compare-Object $leftSide $rightSide -Property Path,Hash | Sort-Object -Property Path |
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
$LeftFolder = "C:\inetpub\wwwroot\Console\Website\" | |
Get-ChildItem $LeftFolder -Recurse | | |
Where-Object { $_.FullName.Replace($LeftFolder,"") -notmatch "^App_Data\\|^sitecore\\|^sitecore modules\\|^temp\\" } | | |
Get-FileHash -Algorithm SHA1 | | |
Select-Object @{Label="Path";Expression={$_.Path.Replace($LeftFolder,"")}},Hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment