Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to check if a folder/directory has subfolders?
Answer: You can use code like this to check all items in a folder:
Function HasSubFolder(folder as FolderItem) As Boolean
dim c as Integer = folder.Count

for i as Integer = 1 to c
dim item as FolderItem = folder.TrueItem(i)

if item<>Nil and item.Directory then
Return true
end if

End Function
We use trueitem() here to avoid resolving alias/link files.
Also we check for nil as we may not have permission to see all items.
And if one is a directory, we return without checking the rest.

Feedback, Comments & Corrections

The biggest plugin in space...

MBS Xojo tutorial videos