View Single Post
Old 06-16-2008   #1 (permalink)
akcorr


 
 

Compare-Object and Get the name of object/File?

I want to compare two directories and copy the files that are not in
directory $A to directory $B. My initial try to see what I get back:

$A = Get-ChildItem -path C:\test1
$B = Get-ChildItem -path C:\test2

$C = Compare-Object $A $B

ForEach ($f in $C)
{
Write-Host $f
}

It Spit back this:

@{InputObject=test.txt; SideIndicator=<=}
@{InputObject=test2.txt; SideIndicator=<=}
@{InputObject=test3.zip; SideIndicator=<=}
@{InputObject=test4.txt; SideIndicator=<=}

How would I got about extracting the fullnames for each of those files?
After that I can pass it to a function for work to be done.


My System SpecsSystem Spec