os.Path.dirsort() defines the sort criteria and sort order for the opened directory:
CALL os.Path.dirsort(criteria, order)
where:
undefined = means that no sort criteria is set which is the default. In this case all the entries are read as returned by the os.Path methods,
name, size, extension, or type = sorts the directory by file name, size, extension or type (directory, link, regular file) respectively,
atime = sorts the directory by access time,
mtime = sorts the directory by modification time;
1 = defines the ascending order,
-1 = defines the descending order.
By this function invocation, the sort criteria and sort order are defined for any subsequent ops.Path.diropen() call.
When using the sort criteria name, the directory entries are ordered with regard to the current locale. When sorting by any other criteria, entries of the same value for the defined criteria are sorted by name following the value of the order parameter.
#sort by name, ascending
CALL os.Path.dirsort("name", 1)