Return sorted FolderItem

Does anyone know if there is a way to quickly sort the results of a FolderItem by creation date? I need to delete the oldest file in a folder when called. I know I can get the results and put them into an array and sort, but I was hoping there was some FolderItem method that will return the FolderItem already sorted by date. Thanks for any help.

I’ve always parsed the results of a DIR shell command. However a single pass through the folder storing the filename + the sqldatetime of the modified date in 2 arrays and then using sortwith?

I know you are more than capable of seeing these options, & am curious if there is a better answer myself.

I don’t think there is. Unless MBS has a function amidst the million functions in their suite.

OK, thanks. Not a huge deal, just was hoping there was something built in that I was missing.

if on Mac or Linux : http://alvinalexander.com/linux/unix-linux-ls-command-file-sort-sorting

On Windows:

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true

dir /o:-d /t:c

huh…Currently I create two arrays, one of the name and one of the time stamp, I then use sortWith to sort the timestamp array and then the sorting order is applied to the name.

Sam, yes, that is what I am doing, was just hoping there was something built in. Not a huge deal.

Gotchya.