Inept Apple Shortcuts user needs help renaming, dating, moving files

This is something I did in Automator but which did not convert to Shortcuts or run as is on a modern Mac — and I cannot get my head around Shortcuts.
I save assorted utility and credit card bills to Downloads. I want to rename them, add the current date, and move them to respective folders. Bill A would get a Bill A name and go to the Bill A folder, etc.
They arrive in Downloads with various naming conventions but all types (gas, electricity, credit card) begin with different prefixes (text strings?). I want a separate Shortcut for each bill type. For the gas bill I would trigger the gas bill Shortcut , probably from the Services menu.
I want to avoid a clever omnibus Shortcut that would collect all the different bill types and distribute them to the relevant folders. Too complicated for me to troubleshoot or tweak.
But I can handle a “Run AppleScript with…” action. In Automator this one used to work:

on run {input, parameters}

tell application "Finder"
	move (file 1 of (path to downloads folder) whose name starts with "XX_X") to folder "Macintosh HD:Users:xxx:Bills:XX_X Bills"
end tell
return input

end run

I would be thrilled if someone can sort this! Cheers.

silvercoyote. It’s not clear to me if your request is for a shortcut that renames, dates, and moves files or to get the AppleScript in your post to work. If the latter is the case, the following worked on my computer. There’s no input that I can see, so the shortcut does not return any input.

Move Files.shortcut (21.7 KB)

If the former is the case, please include source and destination path examples, such as the following:

/Users/robert/Downloads/GAS Some Company.pdf # input path

/Users/robert/Bills/GAS/Some Company - 20251224.pdf # output path

FWIW, I went ahead and wrote a shortcut based on the above understanding. A few comments:

  • The user’s Home folder and the desired file name prefix must be set at the top of the shortcut.
  • The output file name has both date and time stamps to avoid having to deal with existing files in the destination folder.
  • If testing this shortcut, please be sure to have backups of the moved files.
  • The shortcut worked on my Tahoe computer without issue.
  • The following screenshot only shows a portion of the shortcut.

Move Files with Specified File Name Prefix.shortcut (24.3 KB)

Many thanks, peavine.
I’ve begun stumbling my way through this but it will take me some time. For a start, the term prefix may be more technical than I understood. Basically I mean just the first few letters of a file name. The script can’t find “statement.”, which is how one of the file names begins. It tells me no files with a filename prefix were found. So prefix must be the wrong term.
By the way I don’t need it to create a new folder or do repetitions. For me, “simple”.
Also, Christmas approaches and you may have better things to do — much as I appreciate your help!