Sort filename by last characters prefixed by #

@dspady, that's great!
Perhaps you could post your solution so that others could benefit.
See How to upload your macro. Instructions for uploading to an existing post are just below the main instruction.

Well, I realized that there were some issues in the filenames that seemed to be fouling up the count. For example, I had a file "abcde #29845.pdf" that was NOT the highest count, but it always came up. (When I first tried this, it worked perfectly well (i.e. I did get the highest count). So, I changed the value to #10000 and tried it, and another file popped up, but it wasn't the highest.
I realized that I needed a simpler system that does not depend on another program to find something, so I have changed how I assign new filenames. I use the system "filename Mon21-n" Where Mon21 is for this month Mar21- and n starts at 1 and goes up. The point for me is to be able to uniquely identify a file if I am writing and want to put in a quick reference. It doesn't matter what the number is. I only needed the highest number so that I would reduce the chance of getting a duplicate number. But if the programming takes too long, or I do not understand what is happening, then maybe I should try something easier. What I have now is practical, depends only on knowing the Month, and knowing that I am unlikely to add more than 100 files in any given month. So, not elegant, but it works.

I do apologize to all of you for ultimately not using what you suggested, but there was a bug, and I don't know what it is, and I can't take up any more of your, or my, time in working it out.

I do NOT know programming. I do not understand the arcane aspects of Keyboard Maestro, even though I know it can do fantastic things. I can program Stata commands for analysis, but can't write code, and at my age I am too impatient to learn.