Thanks in advance.
If you have your directory in a variable like "node", you get the number of children of this node via node.children.lengthsee ScriptNode API | Alfresco Documentation
or use childFileFolders | Alfresco Documentation
there you can choose to get all files, directories or files and directories...
Retrieving data ...