There is a folder in which xml files are beeing copied at no particular time, when an event is happening. I want a php way to inspect the folder’s status and when an xml file arrives, an event will be triggered.(ex.call to the xml parser). So which is the best way (in php) to monitor a folder and trigger events according to it’s status? Thanx!
Share
Haven’t tried it, but maybe Inotify can help you:
There’s a PHP extension for inotify, see InotifyDocs and inotifyPECL.
Another alternative if you’re running on linux is to use a PHP-independent daemon to monitor a directory for changes. You can use dnotify for it (obsoleted by inotify), something like:
It will execute the command each time one of the files in other folder are modified (-a -r -b -s = any access/recursive directory lookup/run in background/no output).
Related: