How to sort array of files

I want to sort array of files, how can I do that?

1 Like

see this answer

alternative: @Mamata_Shee

assign this to your array variable

arrayVariable.AsEnumerable.orderBy(function(x) x).toarray


arrayVariable.AsEnumerable.orderBydescending(function(x) x).toarray
to sort descending

Hi @jack.chan
I’m trying to do this, but getting error as shown below:



please try this instead

Arr_Files.Orderby(Function(F) New FileInfo(F).CreationTime).Toarray

It showing me error:

we would suggest to be more specific within your request / sort definition.

From your screenshot we do see that you are working with find files and folders. On what property you want to order the array (name, creation date…?)

I want to sort the files by their name.


For more clarification,
I’m fetching the files inside a drive folder using Find files and folders activity, so basicallly the output Files12 is the list of objects(files), now I want to sort those fetched files present inside Files12 array.


not knowing all details e.g. the search expression.

the returned array is of datatype: Google File

give a try at:
arrFilesOrdered = yourOriginArray.OrderBy(Function (x)

then replace x with since its a file array

@ppr Finally, it’s working.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.