Q:

AutoHotkey - Find and Replace only some part of multiple Folders in Windows Explorer

I have multiple folders in Windows Explorer which have some part of the name the same and some not.
For example:

FIRST_hello
FIRST_how_are_you
FIRST_goodbye

And I would like to change the first part "FIRST" to "SECOND" so the result should look like this:

SECOND_hello
SECOND_how_are_you
SECOND_goodbye

This is a simple example and of course if there were only 3 folders I wouldn't ask it, but sometimes I have up to 30 folders where I need to change only some part.
Any help would be much appreciated.

A:

#IfWinActive ahk_class CabinetWClass

F1::
for window in ComObjCreate("Shell.Application").Windows
try Fullpath := window.Document.Folder.Self.Path
; MsgBox, %Fullpath%
Loop, Files, %Fullpath%\FIRST_*, D
{
; MsgBox, %A_LoopFileName%
StringReplace, NewFileName, A_LoopFileName, FIRST_, SECOND_
FileMoveDir, %Fullpath%\%A_LoopFileName%, %Fullpath%\%NewFileName%, 1
}
return

#IfWinActive

