I'm looking for help in creating a script that can rename all of the files contained in a directory to a table referenced in a csv file. For example, I have a folder with random file names and I also have a csv file with the current file names in column A, and what the actual file name should be changed to in column B.
I thought about using something along the lines of:
get-childitem *pdf -force | foreach { rename-item $_ $_.Name.Replace((Import-Csv -path .\List.csv).filename, (Import-Csv -Path .\List.csv).newfilename) }
Note that filename & newfilename refer to column A and B respectively.
Nothing really happens when I run this script. I'm a novice with powershell so I've come to the limits of my knowledge of how to accomplish this task. Any and all help will be greatly appreciated!
Thank you all!