Find characters and rename file name using Powershell

file-rename, powershell

Solution

Here's an example to rename all pdf files in the current directory, removing all leading numbers or underscores from the file name:

Get-ChildItem -Filter *.pdf | Rename-Item -NewName {$_.Name -replace '^[0-9_]+'}

Problem

I have a large number of files in a directory with this type of naming convention: "1050_14447_Letter Extension.pdf", etc. I need to remove all characters before the 2nd underscore (including the 2nd underscore). So the new file name would be "Letter Extension.pdf". How can I iterate the single directory renaming accordingly?

Original source