Questions tagged [compareobject]

Usually refers to object comparison in object oriented languages.

Typical cases compare:

  • Ojects values.
  • Object references.
  • Object types.
99 questions
0
votes
0 answers

Powershell Compare-Object missing SideIndicator

I have this following code $filenameFormat1 = "new_permission.txt" $approvedLogsName = "last_permissions.txt" Compare-Object -referenceobject $(get-content "E:\\logs\$approvedLogsName") -differenceobject $(get-content "E:\\logs\$filenameFormat1")…
Mujahid
  • 1,227
  • 5
  • 32
  • 62
0
votes
1 answer

PowerShell - Enumerating through 2 groups of CSV's using foreach and compare-object to output differences

I need to compare 2 CSV files, and output the differences contained in the larger one, that are not present in smaller one based on 2 headers (SiteName, PrimarySMTPAddress). At present, i can do this using the below: #Importing CSV $File1 =…
Royston
  • 433
  • 2
  • 9
  • 25
0
votes
1 answer

Compare files without extension and delete files from folder in Powershell

I compare files inside a folder. In this folder some files are existing in two file formats (filename1.jpg, filename1.bmp, ...) and some files are only existing in one format. I try to find all files which are only existing in .bmp format and…
axl258
  • 3
  • 1
0
votes
1 answer

Comparing shape object retrieved from Selection and the same shape retrieved from ActiveSheet.Shapes set

I'm trying to check if the Shape selected by user is the proper one. For the simplicity, let's say we have only one shape in otherwise empty worksheet. Because of that, we know that the selected shape must be the right one: Sub AreShapesTheSame() …
Tomasz
  • 11
  • 2
0
votes
2 answers

Copy new files from external HD to Desktop with Powershell

Thank you for reading my post and your advice :) The scenario is, that I have an HD built in my desktop where I collected files for many years. So one day I did a backup to an external HD, which I then took travelling and kept on collecting photos…
siboney
  • 56
  • 1
  • 8
0
votes
1 answer

Powershell Compare-Object not comparing arraylists contents

I have 2 arrays and would like to compare it on powershell. I'm using Compare-Object for that but, sometimes the comparison process are not correct. if one of the array have a record which doesn't exist on the other, the diff are…
oRoberto
  • 165
  • 1
  • 11
0
votes
2 answers

Compare-Object PowerShell outputs a 1KB file with 2 null rows

I have a PowerShell script that compares yesterday's and today's file to provide the changes that can be further loaded into an Oracle table for reporting needs. My trouble is that over the weekends when there is no change in the source system,…
0
votes
1 answer

Compare two text files with duplicates and write the distinct differences to text file

I want to compare 2 text files and output the difference in another text file. compare-object (get-content c:\temp\hostname_old.txt) (get-content c:\temp\hostname_new.txt) | Select-Object -ExpandProperty InputObject | Out-File…
Arbelac
  • 1,698
  • 6
  • 37
  • 90
0
votes
3 answers

Adding Results from Compare-Object to Array

I have two files being compared, one a CSV and one a txt file. The CSV file has the information for around 5,000 servers and the txt file has only server names for around 3,000. The columns within the CSV are Name, OS, and Type. This is what I did…
JK72
  • 149
  • 1
  • 8
0
votes
1 answer

Powershell Compare-Object with Hash only pass $_.SideIndicator and not $_.path $_.hash

I am trying to compare two folders at the hash level. I get the hash information; Algorithm, Hash, Path $SourceDocs and $DestDocs both have the Algorithm, Hash, Path When I run Compare-Object, the only value that gets passed along is SideIndicator I…
Woody
  • 15
  • 4
0
votes
3 answers

Compare Object Powershell

I want to compare two objects and get only the different values. I have this code: $a = ("this is blah blah DOG") $b = ("Dit is blah BLAH dog") Compare-Object -ReferenceObject $a -DifferenceObject $b with the above code I get the following…
wrdw
  • 63
  • 7
0
votes
1 answer

Compare multiple CSV columns and return complete data from both in PowerShell

I have two spreadsheets with data which I want to compare to highlight matching and non-matching data with a few "gotchas" - some columns I want to ignore for comparison (score, testname), others I want to include (Filename and hash), and I want to…
AskJarv
  • 184
  • 3
  • 15
0
votes
0 answers

Compare-Object Not Comparing Each Element of Array

I am attempting to use Compare-Object to find elements that are in one array ($fileArray) but not in another ($dictionaryArray). For some reason, Compare-Object is only comparing the last two elements in fileArray. Here is the code I am trying to…
0
votes
1 answer

delete everything after keyword

I try to merge to files with Compare-Object and I got a file like this: Number=5 Example=4 Track=1000 Date=07/08/2018 19:51:16 MatCaissierePDAAssoc= NomImpPDAAssoc= TpeForceLectPan=0 Number=1 Example=1 Track=0 Date=01/01/1999 You can see it repeats…
0
votes
1 answer

SQL Loader failing while loading a .txt file which is a result of compare-object cmdlet

I receive a fixed format file out of a legacy application that is loaded to an oracle table by SQL loader daily. A new requirement needs Day 1 and Day 2 files to be compared and only the difference to be appended, so the data at the end of day 2…