


You can pipe that to a Where-Object filter to pick stuff that is different on the left side.Ĭompare-Object $Folder1 $Folder2 -Property Name, Length | Where-Object Which will list for you everything that is different by comparing only name and length of the file objects in each collection. Then you can use Compare-Object to see which items are different.Ĭompare-Object $Folder1 $Folder2 -Property Name, Length The lazy/mostly right way, which is comparing the length of the files and the accurate but more involved way, which is comparing a hash of the contents of each file.įor simplicity sake, let's do the easy way and compare file size.īasically, you want two objects that represent the source and target folders: $Folder1 = Get-childitem "C:\Folder1"

OK, I'm not going to code the whole thing for you (what's the fun in that?) but I'll get you started.įirst, there are two ways to do the content comparison.
