I have a Flow that operates on a SharePoint library with more than 5,000 items (the dreaded 5,000 limit has been exceeded). One of my first actions is scanning the library using a Get Files (Properties Only) action, which needs to search the entire library, then filter based on one column. Another factor is that I need to sort/order the files based on one of the columns, so that they are retrieved, and eventually merged into a single file, in the correct order. This all works well by using the oData query (just filter the items based on matching a certain value in a column), then an order by query (in this case, I need to order ascending by a column called Doc_Type). The problem is that now the library will not be scanned for all 5,000 + items due to the limit. I have to set top count at 4,999. One nice solution would be to reverse the sort order by using ID desc (descending order of Item ID, or more recent first), in which case, I would solve my issues, because I am typically only dealing with the most recent 500 to 1000 files. But when I switch to sorting by ID descending first, then Doc_Type ascending, my documents will be retrieved out of order, and later passed into a merge array out of order. Filter arrays and other actions cannot sort.
Are there any solutions to either overcome the 5,000 limit, or to do a second sort after the Get Files (properties only) action, to re-sort the filtered list of items by Doc_Type ascending before passing into the merge array?
Thanks for any help on this. Screenshots below:


