I have a large number of xls files with four digits at the start of the name, a generic body, a dynamic month, year, and extraction date at the end of the filename.
For example: 9999_Generic_Name_Here_Oct_2017_05102017.xls
I need to rename these files, replacing the first four digits with a corresponding three character alphanumeric code, but keep the rest of the filename and extension the same. Each month there will be a new batch of files with a different month and different extraction date.
I have been trying to manipulate the following code to work with -like and wildcards but I have been hitting brick walls.
Import-Csv "C:\data\Rename_Files.csv" | foreach { Rename-Item -Path $_.Path -NewName $_.NewName }
In the Rename_Files.csv I have two columns with the path / original name and new name.
How do I use the above code to do this, or is there a better way ?