Monitor a directory recursively and run a command in a thread