Welcome Forums General PowerShell Q&A Renaming files from CSV

Viewing 1 reply thread
  • 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: 11
      Points: 55
      Helping Hand
      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/

       

Viewing 1 reply thread
  • The topic ‘Renaming files from CSV’ is closed to new replies.