I want to remove the last 11 characters of multiple files names. For example I have these file names:
ABCDE_2015_10_20
HIJKL_2015_10_20
MNOPQ_2015_10_20
RSTUV_2015_10_20
would like to rename them to
ABCDE
HIJKL
MNOPQ
RSTUV
I have tried using the follwing code:
Get-ChildItem 'E:\Thomson Reuters\Stage' | rename-item -newname { [string]($_.name).substring($_.name.length -14) }
Can anybody tell me where I am going wrong?