MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to check if a folder/directory has subfolders?
Feedback.

Answer: You can use code like this to check all items in a folder:
Example:
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
next

End Function
Notes:
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.




Links
MBS FileMaker Plugins