Hi I'm trying to rename file names with regex and powershell. I got it to replace certain files with the following code but i want to do this for everything after the _underscore. I got over a hundred files i need to rename.
get-childitem *.pdf | foreach { rename-item $_ $_.Name.Replace("_R12B", "") }
Here are example files i'm trying to change;
YTER-01-0B-B-PD-00003-2_R12B
YTER-01-0A-B-PZ-00001-2_R9B
YTER-01-0U-B-PG-00003-1_R1B
YTER-01-0G-B-PP-00005-1_R4B