I have about 30K files that have been named in the following manner
Spr16_51_5881_ELA_10_XXXXX1234X_SMITH-JOHN.pdf
Spr16_51_0021_MAT_03_XXXXX4321X_JONES-LISA.pdf
The XXX section in the middle may not always end with an X but the section between the two "_" is always 10 characters and will always have 5 leading X's. The string in front of the XXX section is not always the same and may be shorter or longer however, the the XXX section will always start after the 5th "_".
Ultimately what I would like to do is either move the LASTNAME-FIRSTNAME section (which obviously can be any length) to the front of the file like below
SMITH-JOHN_Spr16_51_5881_ELA_10_XXXXX1234X.pdf
JONES-LISA_Spr16_51_0021_MAT_03_XXXXX4321X.pdf
or
Remove the 10 character XXX section all together like below
Spr16_51_5881_ELA_10_SMITH-JOHN.pdf
Spr16_51_0021_MAT_03_JONES-LISA.pdf
Please help!