How to shorten filename - rename file

I managed to save attachments from outlook emails. However, I need to change the name of the files I downloaded. I need to remove the last 7 characters from the file. Any suggestions how to do that in the easiest way?

File name is saved as follows: File_Name_20210325_123456 , I need to change it to File_Name_20210325 (removing last 7 characters).


Welcome to the forum
have a look here with the usage of substring

in case of we also have to take care about handling the file extension we can adopt

1 Like

Thanks Peter, I got it to work. I just need to get the extension as .xlsx

Edit: Just added + “.xlsx”

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.