Below is a basic snippet that will count the number of files in a directory. I needed it for a project and thought I might as well share it with the group. It may be useful with the ShowFiles snippet.
$total= count(glob(’/full/path/to/directory/*’));
return "$total files exist in this directory";