Are you using version 2 or 3? I’ll assume 3 for now.
Items get put in the ToC if the section layout they have assigned has a page break in, so if both folders and documents are bing inserted try assigning a different section type to documents and then assigning a different layout to that section type should work. For example folders are usually section type Heading and documents are type Section. Each then should have a different section layout assigned in Assign Section Layouts.
If you start reading from page 552 in the Scrivener manual (in the Help menu) it tells you how the ToC works, how to include/exclude parts of your book, and also has links to other sections of the manual which will also help.
Thanks Rob, that sorted me out but it appears to have led to an issue. When I compiled, it worked perfectly. I then tweaked so that it didn’t generate an HTML ToC but decided to change it back but I now get the following error