fileMonitor function created