I need to traverse all the files in the folder structure of the directory accessed by the app from shared servers. With the inclusion static libraries I'm able to access various servers and the files shared in the them. List of all servers are stored in NSArray
I need to traverse through all folders shared by server to store all files in a container. I have used recursion but that has huge impact on the performance in case number of folders and sub folders increase.
Can anyone suggest any algorithm or logic to traverse the directory structure.
Kindly refer below illustration to have an idea of structure.
One of the possibility could be usage of threads but how to divide the logic to iterate all folders for files so that threads can work on them parallel.
Being a mobile app I don't have a luxury of memory.