I'm having a really difficult time figuring out what PS is trying to tell me. I've created a script that is intended to compare the files in two directories. I want to output any differences in Name, Number of files, or length in either directory. Ultimately, I'd like for it to error if there are differences. Here's what I have:
Write-host "$(Get-Date) - Comparing $deploy_src\bin $deploy_dst\bin"
$bin_src = Get-ChildItem $deploy_src
$bin_dst = Get-ChildItem $deploy_dst
if (Compare-Object $bin_src.Name $bin_dst.Name) {
# throw "Directories differ"
}
And here's the (less than helpful) output I'm seeing:
02/24/2020 09:57:36 - Comparing J:\AdvantageProxy\Development\bin J:\AdvantageProxy\Deploy-QA-2020-02-21\bin
02/24/2020 09:57:36 - done.
Name Length SideIndicator
---- ------ -------------
38 =>
20 <=
Update: The files are on an FSx share accessible by a Mac. This is what the output is for diff, which shows only .DS_Store in a directory accessed directly from the Mac:
$ rsync -n -a -i --delete /Volumes/share/AdvantageProxy/Development/bin/. /Volumes/share/AdvantageProxy/Deploy-QA-2020-02-21/bin/.
*deleting .DS_Store
.d..t....... ./
.d..t....... de/
.d..t....... es/
.d..t....... ja/
.d..t....... ru/
( I used rsync in order to avoid taking the time for diff to compare the contents of the files. ... This shows that there's a file in $deploy_dst\bin that isn't in $deploy_src\bin, and the the timestamps on several folders differs. I expect to see something similar with the Powershell solution. )
Also to note - I'm trying to avoid installing additional dependencies, if possible, which is why I'm trying to do this through PS.
I ended up creating my own solution. The relevant parts of it look like this: