Wildcards for duplicate folders

I searched and searched, but did not find this on any threads…

I currently have a script that creates a folder structure within a volume chosen by the user.
Part of the folder structure’s creation is based upon a job number that can be automatically assigned or manually assigned.
They also input a clients name and description…

I have set the auto number to start at i= “1001”
I need to set a wildcard so that the finder looks for a match in i or the first four numbers as text. If it finds a match I need it to assign i+1

thanks

Hi,

When you get the list of folders, the last folder should have the highest number I think. So, just get the last folder.

set f to choose folder
tell app “Finder”
set folder_name to name of last folder of f
end tell
set n_text to text 1 thru 4 of folder_name
set n to n_text as integer
set next_n_text to (n+1) as string

Note that all your numbers need 4 digits or the Finder will probably mess up the order.

gl,