Ignition communication with a driver or folder, alarm when folder reach max capacity

Hello everyone

Trying to build a custom script or find a way to create an alarm in Ignition when a folder ( folder stores images that are not good from a Cognex Camera) reach max capacity. trying to get some ideas on how to create the comm, how to get the capacity and link memory tag, any help would be highly appreaciate

Gateway timer script that runs at a set rate(1s or 5s) to check the number of files in the folder or get total size of all items in the folder. Once its above a limit, send out a warning email, or set a memory tag to 1 and have an alarm defined on that tag.

The folder will need to be accessible from the gateway device, as perspective does not have access to the local client's filesystem.