Use javascript to count the number of files in directory

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 10:58 AM
Hello everybody i need some help. I have to use javascript to count the number of files in a directory and have that value in a variable. Does anyone knows how to do that.
Thanks in advance.
Labels:
- Labels:
-
Alfresco Content Services
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2018 09:02 AM
If you have your directory in a variable like "node", you get the number of children of this node via node.children.length
see ScriptNode API | Alfresco Documentation
or use childFileFolders | Alfresco Documentation
node.childFileFolders(true, false).length
there you can choose to get all files, directories or files and directories...
