Code: Select all
s_Folder := DirSelect("*E:\" , 3 , "Select Folder:")
s_Prefix := InputBox("Prefix: ").Value
Loop Files , s_Folder "\*.*", "R"
FileMove(a_LoopFileFullPath , a_LoopFileDir "\" s_Prefix " " Format("{:03}" , a_Index) "." a_LoopFileExt)
So when the folder name doesn't contain the prefix, we get this, as expected:
Before:
After (Prefix="Colour"):E:\Test Folder\Red.png
E:\Test Folder\Green.png
E:\Test Folder\Blue.png
But when it does, we get this:E:\Test Folder\Colour 001.png
E:\Test Folder\Colour 002.png
E:\Test Folder\Colour 003.png
After (Prefix="Test"):
And with more than a thousand files, we get:E:\Test Folder\Test 1001.png
E:\Test Folder\Test 1002.png
E:\Test Folder\Test 1003.png
After (Prefix="Test"):
In these cases it works fine again:E:\Test Folder\Test 10001.png
E:\Test Folder\Test 10002.png
E:\Test Folder\Test 10003.png
...
E:\Test Folder\Test 10999.png
E:\Test Folder\Test 11001.png
E:\Test Folder\Test 11002.png
E:\Test Folder\Test 11003.png
After (Prefix="Test Rename"):
After (Prefix="!Test"):E:\Test Folder\Test Rename 001.png
E:\Test Folder\Test Rename 002.png
E:\Test Folder\Test Rename 003.png
But not here:E:\Test Folder\!Test 001.png
E:\Test Folder\!Test 002.png
E:\Test Folder\!Test 003.png
After (Prefix="Testing"):
I don't know whether this is an issue with AHK, or with Windows. My workaround is to rename the folder "!Test Folder" and use "Test" as the prefix.E:\Test Folder\!Testing 1001.png
E:\Test Folder\!Testing 1002.png
E:\Test Folder\!Testing 1003.png