This example uses Bubble Sort to sort a list of files returned by the GetFileList command. Swap the greater than sign on line 15 to change the sort direction.
Code: Select all
GetFileList>c:\temp\*.*,FileList,;
Separate>FileList,;,Files
Let>Max=Files_Count
GoSub>Bubble_Sort
//Sorts Files_x array
//Set Max to number of elements
SRT>Bubble_Sort
Let>has_swapped=0
let>i=1
Repeat>i
Let>next=i+1
//change sign on next line to change direction of sort
if>Files_%i%>Files_%next%
Let>store=Files_%i%
Let>Files_%i%=Files_%next%
Let>Files_%next%=%store%
Let>has_swapped=1
endif
Let>i=i+1
Until>i=Max
If>has_swapped=1
GoSub>Bubble_Sort
Endif
End>Bubble_Sort