Hi Everyone,
I am trying to filter the contents of a specified folder and then batch rename them in numerical order. So my folder will contain numerous file extentions such as .txt, .pdf, .jpg etc and I need to just filter the .jpg files. Once they have been filtered I want to add the word drawing to the end of them followed by a number. So for example the starting file name is beach.jpg and once done it will be renamed as beach-drawing-01.jpg. The file name will not change (beach or whatever it is named as this will change) but the the word drawing will be added followed by a number (-01, -02 etc.). I have been trying for hours to work this out but to no avail! My current way will only rename one of the files before giving me an error message! I have attached a print screen of my currently not working macro.
Thank you in advance for any help

Add Drawing to the jpeg files only.kmmacros (4.7 KB)
It is better to upload the actual Macro as well as a screenshot as it makes it possible to test without having to recreate your Macro.
But I can see from your screenshot that the problem seems to be that you are not incrementing the FileNameCounter Variable. You set it to 0 at the start but never change it.
You want it to count up by 1 just before any renaming of any file. So, just before your "Move or Rename" Action put a "Set Variable to Calculation" Action setting FileNameCounter to FileNameCounter + 1
Click to Show Image of Actions
Ah ok, I have uploaded the file now. I will add your suggestion in and see how I get on. Thank you for your help 
Aso, you might want to set the format of the numbering. For 001, 002 etc you would do that with the gear menu like this:
1 Like
Done. Thank you for your help here. It is only naming one of the files though so there is 4 files in the folder 2 of them are jpg files but its only renaming one of the jpg files for some reason! I have added the updated code here.
Updated.kmmacros (4.8 KB)
Because the new Action to add 1 to FileNameCounter had been put in the wrong place. Also, you still need your original Set FileNameCounter to 0. See if the below works for you:
Add Drawing to the jpeg files only v2.00.kmmacros (5.3 KB)
Click to Show Image of Macro
1 Like
Genius! Works great. Thank you so much. I was not a million miles away but would never have worked it out without your help 
1 Like