Renaming files from CSV

Welcome Forums General PowerShell Q&A Renaming files from CSV

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 month ago.

  • Author
    Posts
  • #171736

    Participant
    Topics: 1
    Replies: 0
    Points: 12
    Rank: Member

    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
    }
  • #172057

    Participant
    Topics: 0
    Replies: 4
    Points: 21
    Rank: Member

    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/

     

You must be logged in to reply to this topic.