I have a ListView where I list all the subfolders in a folder. First I create a list, and before loading them into the ListView I test to determine whether each entry is a Folder rather than a file. In most cases this works fine, but occasionally I hit a folder that has several thousand files in it. When this happens, the testing takes a long long time, because it has to test all the entries!
I can limit the total number of entries searched, as shown here, but it is possible that no folders would show up at all.
Would appreciate it if anyone can show me a way to list just the folders quickly, even in a folder that contains hundreds of files.
I can limit the total number of entries searched, as shown here, but it is possible that no folders would show up at all.
B4X:
lstAllArray = File.ListFiles(edtPath.text)
' Sort the list
lstAllArray.Sort(True)
' Create a "real" lists. Limit the number of items counted to 75
' to avoid long periods with no apparent activity.
For i = 0 To Min(lstAllArray.Size - 1, 75)
' Create a proper list of just Folders
If File.IsDirectory("", edtPath.text & "/" & lstAllArray.Get(i)) Then
lstFolders.Add(lstAllArray.Get(i))
End If
Next
Would appreciate it if anyone can show me a way to list just the folders quickly, even in a folder that contains hundreds of files.