You can use "file-get-file-info" API in Clustered ONTAP Vserver context (Storage Virtual Machine) and 7-Mode Data ONTAP systems.
You just need to provide the "path" for the file list. Once you get the list of files (and directories), you can filter out the files you are looking for and get the count.
Hope this helps. Please feel free to revert back if you need any more information on this.