How can I edit a folder of files and rename all the files in that folder by finding a fixed string of characters and then take that string plus four characters and move it to the prefix of the file name?
As an example, I have folder of pictures with various names but within each name is the date. I would like to take that date string and move it to the beginning of the files name.
Here is a file name:
AK_ADVOUTPOSTB1CHARACTER_20171202_406828017946.jpg
as you can see there is a string of "20171202" in this file but each file may have a different month and day but they are all "2017".
So I'd like to find the string starting with "2017", then take that plus the next four characters and move it to the beginning of the file.
As an ultimate solution, I'd like to be able to find the string "_2017" take that string plus the next four characters, edit it to look like "2017 12-02", and then place that at the beginning of the name.
File name example:
AK_ADVOUTPOSTB1CHARACTER_20171202_406828017946.jpg
2017 12-02 AK_ADVOUTPOSTB1CHARACTER_406828017946.jpg
If it takes several commands to accomplish that would be fine with me, I'd just like to get this accomplished if possible.
(If you know of a utility that can accomplish this, that would be helpful, too.)