I am new using powershell and I need some help with a script.
I been using dir | Rename-Item -NewName {$_.Name -replace "Abc_123", "XYZ"}
to change a bulk of file names in a folder but I would like to do more.
I need to change from "Alex_Chris_123_456_ABC" to "AC_123_456_ABC".
I imagine that it goes like this.
Get-ChildItem -File -Recurse | % { Rename-Item -Path $_.PSPath -NewName $_.Name.replace("Abc_123", "XYZ")}
But this only changes specific characters. How can I add a conditional statement that will get the 1st character of strings before the first integer?