I have a routine that runs once a day to check for a new file to import, after I import that file, I create a backup copy and store it in the same directory. I want to only keep the last four of of those files, so whenever my routine runs, after I create the backup copy, I want to delete all but the last four. The filenames for the backup start with the character I and then the datetime() the backup was created. How do I sort the results of adir() command by the first element (filename). Once I have the array in the right order, I can just loop through, starting on the 5th one and delete the files. Below is what I was trying, but it doesn't sort it in decending order. I think I'm missing something in the asort.
Thanks
lnFiles=ADIR(laBackFiles,'i*.dat')
ASORT(laBackFiles,1,1,1)
? laBackFiles[1,1]
? laBackFiles[2,1]
? laBackFiles[3,1]