PowerShell - Compare two files not showing correct data

394 Views Asked by At

I am trying to compare to CSV files with the exact same headings (parent ID, Folder Name, Folder Code 1) However, it's not showing all the data. For example, I know one class is Called "7 Food and Hospitality 2 2021" but the output doesn't show this in the results.
enter image description here

However, when I just compare 1 column (folder Name) it states the difference correctly. However, I need the output of all columns as this is in the format for bulk uploading into another system. enter image description here

The part of the code I am having is as followed:

$term1 = Import-Csv -Path 'C:\temp\Term 1.csv' | Select-Object 'parent ID','Folder Name','Folder Code 1'
$term2 = Import-Csv -Path 'C:\temp\Term 2.csv' | Select-Object 'parent ID','Folder Name','Folder Code 1'

$newClassess = Compare-Object -IncludeEqual -ReferenceObject $term2 -DifferenceObject $term1 | Select-object -ExpandProperty InputObject

As you can see in the term 1 CSV (snippet) there is not 7 Food and Hospitality 2 but there is in CSV term 2 enter image description here

0

There are 0 best solutions below