Simple script for comparing files in two directories.
param ( [Parameter(Mandatory=$true)][string]$originalDir, [Parameter(Mandatory=$true)][string]$newDir ) $fso = Get-ChildItem -Recurse -path $originalDir foreach($file in $fso.Name) { echo comparing $originalDir\$file to $newDir\$file Compare-Object -ReferenceObject $(Get-Content $originalDir\$file) -DifferenceObject $(Get-Content $newDir\$file) -IncludeEqual }
Will compare line by line the files in the originalDir with those in newDir with the same name.
- Probably breaks if the file isn’t in newDir
- Doesn’t check for extra files in newDir.
No comments:
Post a Comment