Advertisement
Guest User

List File Differences

a guest
Apr 6th, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param(
  2.     [Parameter(Mandatory=$true)]
  3.     [string]$SourceFile,
  4.     [Parameter(Mandatory=$true)]
  5.     [string]$DestFile
  6. )
  7.  
  8. $str1 = @(Get-Content $SourceFile)
  9.  
  10. $str2 = @(Get-Content $DestFile)
  11.  
  12. Write-Host "Строки из $SourceFile, которые отсутствуют в $DestFile"
  13.  
  14. for($i = 0; $i -lt $str1.Count; $i++){
  15.     if ($str2 -notcontains $str1[$i]){
  16.         "[$i]: $($str1[$i])" | Out-Host
  17.     }
  18. }
  19.  
  20. Write-Host "========================================================================"
  21. Write-Host "Строки из $DestFile, которые отсутствуют в $SourceFile"
  22.  
  23. for($i = 0; $i -lt $str2.Count; $i++){
  24.     if ($str1 -notcontains $str2[$i]){
  25.         "[$i]: $($str2[$i])" | Out-Host
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement