Reputation: 1
I'd like to compare 2 folders including a number of sub-folders with PowerShell. So far I've used the following:
$Folder1 = Get-childitem "K:\Program Files\"
$Folder2 = Get-childitem "K:\Program Files2\"
Compare-Object $Folder1 $Folder2 -Property Name, Length
However this doesn't look into all the sub-folders Could you please help and advise what the best way would be here?
Upvotes: 0
Views: 499
Reputation: 212
Tested it with -Recurse and it works
$folderA=Get-ChildItem "C:\Test" -Recurse
$folderB=Get-ChildItem "C:\Test - Kopie" -Recurse
Compare-Object -ReferenceObject $folderA -DifferenceObject $folderB -Property Name,Length
Upvotes: 1