This is probably because your directories are marked for archiving. As you are asking for archived items, the function returns these directories. You probably want to NOT ask for archived items - only ask for normal files. Or you can filter the results using the GetFileAttrs function - this function returns 1 if the input is a directory.