Renaming files from CSV

I have a DB dump of 1.7M attachments and a CSV file “rename.csv” with DB_Name col, Origin_Name col, and Size col. I can get my script to rename the DB_Name to Origin_Name but I would also like to use the Size column to match the correct file. There are duplicates in the Origin_Name column. I would like to use DB_Name and Size to find the correct file and rename to Origin_Name.

Thank you

Import-Csv rename.csv | ForEach-Object{
Rename-Item $_.DB_NAME $_.Orig_Name
}

I googled what I think you’re trying to do (compare columns and make a match somehow and post the match in a third column?), there’s a post here that might help, but I admit, I don’t really understand the question…

https://powershell.org/forums/topic/match-multiple-csv-columns/