Use the property IsFolder to check if the current object is a folder.
property IsFolder: Boolean;
Returns true if the current object is a folder.
ShellControls.TJamShellListItem