I have a PowerShell code that renaming the files name, and just cutting some letters from the end of the file name. Now I am trying to rename it like this: For example my file name is "a_b_c_d_e_f.txt", so I want to change it to "a_b_c.txt". Any Ideas?
Get-ChildItem 'C:\Users\xxx\Projects\testfiles' -filter *.txt |
Rename-Item -NewName {$_.name.substring(0,$_.BaseName.length-9) + $_.Extension}