Modified Java directory watcher example, made to be generic and useful.