multiple files to be short into folders

Hallo
i was wondering if it is possible to make a script where numerous files can be sorted in to folders
many of the files (photos) have a number behind them like i 2016-11-11 safari1 and stopes and 222
then the next files comes up like 2016-11-05 Deepsea fishing1-330 and so on
i have more then 50000 files in one folder and I would like to get them sorted by filename

i have tried some like this but I don’t seam to work

tell application “Finder”

set selected to selection

set current_folder to item 1 of selected

set mlist to every file of current_folder

set x to mlist

repeat with i from 1 to the count of x
	
	set this_file to item i of x
	
	if i is not 1 then
		
		set previous_file to item (i - 1) of x
		
		set prev_ext to cur_ext
		
		set prev_name to new_name
		
	else
		
		set prev_name to ""

any time tie on what to do
and I am no script guru what so ever :frowning:

We’re really lacking in information here. Can you give us:

  • A list of several example file names
  • What criteria you’re sorting on
  • The name and location of the folders you want them sorted into
  • also, post your whole script, and use the “applescript” tag button at the top of the posting window. Your script doesn’t even end the "If’ or “repeat.”

There are a lot of gurus who provide a ton of free help here, but they generally look for someone who at least takes the time to clearly document what they’re trying to do and how they’ve attempted to solve the problem so far before they want to sink time into helping.