This example uses regex to see if the name ends with .jmp (the $ matches the end of the line) or begins with the letter a (the ^ matches the beginning of the line). Regex returns a missing value if the match fails. The RemoveFrom function deletes offending items from the list. The for loop runs backwards so the deleted items don't change the part of the list that hasn't been examined already. (When an item is deleted, the indexes of subsequent items change.)
NULL tells regex not to replace the matched text; IGNORECASE tells regex that Jmp and jmp should match.
x=filesindirectory("$desktop");
for(i=nitems(x), i>= 1, i--,
if( ismissing(regex(x,".Jmp$|^a",NULL,IGNORECASE)), removefrom(x,i) )
);
show(x);
x = {"animated.gif", "stories.jmp", "Untitled 3.jmp"};
You could build the last modification date into this loop, or keep it in a separate loop after this one.
Craige