Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PowerShell to display full path after comparing two file names and sizes?

$
0
0

I'm trying to compare file names and sizes on a source and destination and if they have the same name but are a different size, list the file name and its full path so I know where to go look at both files.

I'm playing with:

PS C:\> $myserver01 = Get-ChildItem -Force -Recurse -path \\myserver01\myfiles
PS C:\> $myserver02 = Get-ChildItem -Force -Recurse -path \\myserver02\myfiles
PS C:\> Compare-Object $myserver01 $myserver02 -Property Name, Length | Where-Object {$_.SideIndicator -eq "<="}

which obviously does not get me what I'm after completely. It does show me which files are named the same but have a different size but I have no way of knowing the true location of where the file sits.

How would I add the full path after comparing their file size and name?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>