Added function for watching directories and executing commands.