This question already has an answer here:
I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this:
... arquivo_1.jpg arquivo_2.jpg ... And following this sequence, but it needs to know the extension, in this case I used the extension. Jpg.
I was wondering how do I optimize the script so that it renames but keeping the original extension of the file and keep doing the sequence I described above. Can someone help me?