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

or

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:

Thanks

@Mamata_Shee

please try this instead

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

@jack.chan
It showing me error:

@Mamata_Shee
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…?)

@ppr
I want to sort the files by their name.

Thanks

@jack.chan
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.

Thanks

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) x.name).toArray

then replace x with x.name since its a file array

@ppr Finally, it’s working.

Thanks.

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