Suppose there are 3 files (abc.jpg, test.bmp and xyz.png) in SD card. When I use the f_readdir function, I understood that it does not retrieve the files in alphabetical order. So in which sequence it is retrieving the file name? Please share your ideas.
As far as your application is concerned, the order is undefined. This means that, if the order is important to your application, then it is up to your application to perform the require sorting/ordering.
In practice, the order probably depends on the order in which the entries actually appear on the physical medium. That will depend upon the lifetime history of the card...