I have a number of files of different type in a directory: file, file0, file.txt, file.jpg etc.
Some with extensions, some without.
I want to rename files in a directory by inserting 'final' to them.
So they would appear as: filefinal, file0final, filefinal.txt, filefinal.jpg etc.
I imagine that to deal with the presence of files with and without extensions, I'll have to use some if statements, maybe not. To deal with the files with extension I've been thinking that perhaps I could determine the index of the decimal and then add the 'final' string right before that. But I'm not sure how to do that or if it's the best approach.
Any tips greatly appreciated.