Renaming files- not new, but I am SO frustrated trying 😢

Hello,
Everything I’ve read says renaming files w/in folders is the simplest of scripts, but I can’t find the “simple” script anywhere???
I began “writing” the following script, but I need to get to about 2000 and I got wind of this site and thought I’d give it a try. Check this out:

tell application “Finder”
activate
select folder “Kitty 3”
open selection
select 1st file of folder “Kitty 3”
set name of selection to “000001.JPG”
select 2nd file of folder “Kitty 3”
set name of selection to “000002.JPG”
select 3rd file of folder “Kitty 3”
set name of selection to “000003.JPG”
select 4th file of folder “Kitty 3”
set name of selection to “000004.JPG”
select 5th file of folder “Kitty 3”
set name of selection to “000005.JPG”
select 6th file of folder “Kitty 3”
set name of selection to “000006.JPG”
select 7th file of folder “Kitty 3”
set name of selection to “000007.JPG”
select 8th file of folder “Kitty 3”
set name of selection to “000008.JPG”
select 9th file of folder “Kitty 3”
set name of selection to “000009.JPG”
select 10th file of folder “Kitty 3”
set name of selection to “000010.JPG”
select 11th file of folder “Kitty 3”
set name of selection to “000011.JPG”
select 12th file of folder “Kitty 3”
set name of selection to “000012.JPG”
select 13th file of folder “Kitty 3”
set name of selection to “000013.JPG”
select 14th file of folder “Kitty 3”
set name of selection to “000014.JPG”
select 15th file of folder “Kitty 3”
set name of selection to “000015.JPG”
select 16th file of folder “Kitty 3”
set name of selection to “000016.JPG”
select 17th file of folder “Kitty 3”
set name of selection to “000017.JPG”
select 18th file of folder “Kitty 3”
set name of selection to “000018.JPG”
select 19th file of folder “Kitty 3”
set name of selection to “000019.JPG”
select 20th file of folder “Kitty 3”
set name of selection to “000020.JPG”
select 21st file of folder “Kitty 3”
set name of selection to “000021.JPG”
select 22nd file of folder “Kitty 3”
set name of selection to “000022.JPG”
select 23rd file of folder “Kitty 3”
set name of selection to “000023.JPG”
select 24th file of folder “Kitty 3”
set name of selection to “000024.JPG”
select 25th file of folder “Kitty 3”
set name of selection to “000025.JPG”
select 26th file of folder “Kitty 3”
set name of selection to “000026.JPG”
select 27th file of folder “Kitty 3”
set name of selection to “000027.JPG”
select 28th file of folder “Kitty 3”
set name of selection to “000028.JPG”
select 29th file of folder “Kitty 3”
set name of selection to “000029.JPG”
select 30th file of folder “Kitty 3”
set name of selection to “000030.JPG”
select 31st file of folder “Kitty 3”
set name of selection to “000031.JPG”
select 32nd file of folder “Kitty 3”
set name of selection to “000032.JPG”
select 33rd file of folder “Kitty 3”
set name of selection to “000033.JPG”
select 34th file of folder “Kitty 3”
set name of selection to “000034.JPG”
select 35th file of folder “Kitty 3”
set name of selection to “000035.JPG”
select 36th file of folder “Kitty 3”
set name of selection to “000036.JPG”
select 37th file of folder “Kitty 3”
set name of selection to “000037.JPG”
select 38th file of folder “Kitty 3”
set name of selection to “000038.JPG”
select 39th file of folder “Kitty 3”
set name of selection to “000039.JPG”
select 40th file of folder “Kitty 3”
set name of selection to “000040.JPG”
select 41st file of folder “Kitty 3”
set name of selection to “000041.JPG”
select 42nd file of folder “Kitty 3”
set name of selection to “000042.JPG”
select 43rd file of folder “Kitty 3”
set name of selection to “000043.JPG”
select 44th file of folder “Kitty 3”
set name of selection to “000044.JPG”
select 45th file of folder “Kitty 3”
set name of selection to “000045.JPG”
select 46th file of folder “Kitty 3”
set name of selection to “000046.JPG”
select 47th file of folder “Kitty 3”
set name of selection to “000047.JPG”
select 48th file of folder “Kitty 3”
set name of selection to “000048.JPG”
select 49th file of folder “Kitty 3”
set name of selection to “000049.JPG”
select 50th file of folder “Kitty 3”
set name of selection to “000050.JPG”
select 51st file of folder “Kitty 3”
set name of selection to “000051.JPG”
select 52nd file of folder “Kitty 3”
set name of selection to “000052.JPG”
select 53rd file of folder “Kitty 3”
set name of selection to “000053.JPG”
select 54th file of folder “Kitty 3”
set name of selection to “000054.JPG”
select 55th file of folder “Kitty 3”
set name of selection to “000055.JPG”
select 56th file of folder “Kitty 3”
set name of selection to “000056.JPG”
select 57th file of folder “Kitty 3”
set name of selection to “000057.JPG”
select 58th file of folder “Kitty 3”
set name of selection to “000058.JPG”
select 59th file of folder “Kitty 3”
set name of selection to “000059.JPG”
select 60th file of folder “Kitty 3”
set name of selection to “000060.JPG”
select 61st file of folder “Kitty 3”
set name of selection to “000061.JPG”
select 62nd file of folder “Kitty 3”
set name of selection to “000062.JPG”
select 63rd file of folder “Kitty 3”
set name of selection to “000063.JPG”
select 64th file of folder “Kitty 3”
set name of selection to “000064.JPG”
select 65th file of folder “Kitty 3”
set name of selection to “000065.JPG”
select 66th file of folder “Kitty 3”
set name of selection to “000066.JPG”
select 67th file of folder “Kitty 3”
set name of selection to “000067.JPG”
select 68th file of folder “Kitty 3”
set name of selection to “000068.JPG”
select 69th file of folder “Kitty 3”
set name of selection to “000069.JPG”
select 70th file of folder “Kitty 3”
set name of selection to “000070.JPG”
select 71st file of folder “Kitty 3”
set name of selection to “000071.JPG”
select 72nd file of folder “Kitty 3”
set name of selection to “000072.JPG”
select 73rd file of folder “Kitty 3”
set name of selection to “000073.JPG”
ETC.
Any help will be appreciated :lol:
PS. That’s only a portion of the first one. I’m up to 699 of the second script :oops:

ScriptBuilders has several scripts which will probably do what you want to do. Here’s a pre-configured search which should yield something useful.

Hi, I guess you should take a look at AppleScript’s “repeat command” :wink:

The basic construction could be something like this:

tell application "Finder"
set i to 1 -- first picture will be called "1.jpg"
repeat with aFile in myFiles
set newName to (i as string) & ".jpg"
set name of aFile to newName
set i to i + 1 -- next picture will be called "2.jpg", and so on, until the last file is reached
end repeat
end tell

If you wish to have filenames like “0001.jpg” you can insert an instruction like

if i <10 then
set newName to "000" & (i as string) & ".jpg"
else if i < 100 then
set newName to "00" & (i as string) & ".jpg"
else if i < 1000 then
set newName to "0" & (i as string) & ".jpg"
end if 

Hope it helps

Farid