SHARE
TWEET

Untitled

a guest Jun 16th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $A = Get-ChildItem -Recurse -path "C:reposDevProjectsBatCurrentVersionRepoCloneTemp" -filter "*.config"
  2.  
  3. $B = Get-ChildItem -Recurse -path "C:reposDevProjectsBatUpgradeVersionRepoCloneTemp" -filter "*.config"
  4.  
  5. $C = Compare-Object $A $B -Property ('Name', 'Length') -PassThru | Where-Object {$_.FullName -eq $_.FullName} | ForEach-Object
  6. {    
  7.     Compare-Object (Get-Content FileA)(Get-Content FileB) #I know this doesn't work
  8. }$C
  9.      
  10. $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
  11. $hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($file)))
  12.      
  13. $A = Get-ChildItem -Recurse -path "C:reposDevProjectsBatCurrentVersionRepoCloneTemp" -filter "*.config"
  14. $B = Get-ChildItem -Recurse -path "C:reposDevProjectsBatUpgradeVersionRepoCloneTemp" -filter "*.config"
  15. $A | %{$_ | Add-Member "MD5" ([System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($_))))}
  16. $B | %{$_ | Add-Member "MD5" ([System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($_))))}
  17.      
  18. $C = Compare-Object $A $B -Property ('Name', 'MD5') - Passthrough | Group Directory
  19.      
  20. $Output = @()
  21. ForEach($File in $C[1].Group){
  22.     $OldData = GC $File
  23.     $C[0].Group | ?{$_.Name -eq $File.Name} | %{
  24.         $NewData = GC $_
  25.         $UpdatedLines = $NewData | ?{$OldData -inotcontains $_}
  26.         $OldLines = $OldData | ?{$NewData -inotcontains $_}
  27.         $Output += New-Object PSObject -Property @{
  28.             UpdatedFile=$_.FullName
  29.             OriginalFile=$File.FullName
  30.             Changes=$UpdatedLines
  31.             Removed=$OldLines
  32.         }
  33.     }
  34. }
  35.      
  36. Get-Date | Out-File "C:reposDevProjectsBatUpgradeVersionRepoCloneTempChangeLog.txt"
  37. $Output|%{$_|FT OriginalFile,UpdatedFile; "New/Changed Lines"; "-----------------"; $_.Changes; " "; "Old/Removed Lines"; "-----------------"; $_.Removed} | Out-File "C:reposDevProjectsBatUpgradeVersionRepoCloneTempChangeLog.txt" -Append
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top