Not recognizing files in ascending name order

I have documents in my folder named 1,2,3,4…43. i use a for each file in folder to open one document at a time, edit it and save it. But it always opens document 1 then 10, 11, 12, and so on. i do not know how to fix this. please help. in the for each file in folder i select ascending name

Hi @julianleow.18

Use the below activity For each File activity and select sort type as ascending!


There is also a thinking error here.
It does sort in alphabetical order. The misconception here is that the numbers in front of the file are… numbers, where the ogical order is 1,2 3, 11, 12 etc…

In fact it is text. They are characters. Alphabetical order first evaluates the 1st character. If equal the second, and so on.
So sorting by name will result in 1, 11, 12, 2, 3. If your filenames are fixed there is no easy workaround other that to dicect the filename, extract the leading numbers, convert to integer in some datatable and then sort.

Clean aproach, though not always possible if you are not in control of the filenames, is to name them 01, 02, 03, 11, 12 ert, or even more leading 0’s if your numbers go up further. Then your regular sorting wil work as you desire.

thank you for the reply. unfortunately it still reads pg 1, pg10, pg11…etc