Back to Geneos FAQ

How to monitor number of files in a folder?

You can achieve this using the FKM plugin or the Toolkit plugin. The script is not supported by ITRS and user is responsible on writing their own script. The following is some examples that you can use.

For Linux:

#!/bin/bash
 echo "name, value"
 echo "count,"`echo $(($(ls -l | grep -v ^d | wc -l)-1))`

For Windows (for drive other that C: ):

@echo off
 CD /D D:\your_folder
 setlocal enableextensions
 set count=0
 for %%x in (*) do set /a count+=1
 echo name,value
 echo fileCount,%count%

 endlocal

By using FKM plugin, enable the wildcardMonitorAllMatches setting on the FKM’s advanced tab.

Note

This will also include the directories on the specified path.

Sample FKM plugin

Enabled wildcard monitor all matches setting

FKM plugin metrics

["Geneos"] ["Geneos > Netprobe"] ["FAQ"]

Was this topic helpful?