You can extract the file index from the file name, sort the indices and reorder the files. See the example code below:
string files = "file_1%(CRLF)file_10%(CRLF)file_2";
int n = files.GetNumTokens(CRLF);
Dataset ids;
ids.SetSize(n);
for (int i = 1; i <= n; i++) {
string file = files.GetToken(i, CRLF)$;
string strFileIndex = file.GetToken(2, '_')$;
int index = strFileIndex.value();
ids[i] = index;
}
ids = sort(ids);
for (int i = 1; i <= n; i++) {
string file = "file_$(ids[i])";
type %(file$);
}
James