See https://forum.xojo.com/39404-read-contents-of-directory/p3#p467436 and change your If to
If (data.int32value(0) And 16) = 16 Then
Also, I would suggest against new’ing a FolderItem just to split it, use PathFindFileNameW and PathFindExtensionW instead.
Here’s a quick fix, it’ll need a little tidy up
https://www.dropbox.com/s/n5zm8cg8tbgvpw0/TestFindForAditya.xojo_binary_project?dl=0
Hope it helps.
On a side note, it might be better/quicker to add the directories into a list then process them off the list. See the following for more info: