for each Ext in 'FileName*.txt'
for each FoundFile in filelist(Root & '\*' & Ext)
'$(FoundFile)' AS FileName,
FileTime('$(FoundFile)') AS FileModifiedDate
set Concatenate = concatenate;
for each SubDirectory in dirlist(Root&'\*')
First 1 Load
FileName as File_Do_not_Delete,
Order By FileModifiedDate Desc
Let vLatestFileName=Peek('File_Do_not_Delete', 0, 'LatestFile');
Trace $(vLatestFileName) is the latest file;
Drop Table AllFiles, LatestFile;
Let vNoofRows= Num(NoOfRows('Older_Files'),'#,##0');
Trace no of older files found $(vNoofRows);
For vFileNo= 0 to NoofRows('Older_Files')
Let vDeleteFileName=Peek('FileName', $(vFileNo), 'Older_Files');
TRACE Deleting $(vDeleteFileName) $(vFileNo);
execute cmd.exe /C del $(vDeleteFileName);
Note:Check the "Can Execute External Programs" setting on the Settings tab in the script editor (bottom part of the screen).
If Vamsee's post got you a working solution, we would greatly appreciate it if you would return to your thread and close it out by using the Accept as Solution button on his post to mark it. If you did something else, you can post that and then use that as the solution, and if you still require assistance, please leave an update.
The only other option I see is along Arthur's post, maybe call a PowerShell script etc. to do things.
To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question. I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.