I wasn't sure that this could be done, but a little research led me to an article (and codebase) on the use of Node.js that would allow for exactly this functionality.
Monitoring a Folder for Changes in Files and Folders with Node.js[
^]
Take a look at the DirectoryWatcher fileChanged event, I think it is exactly what you're looking for. I haven't tested this, so please let me know how this works out for you.