Extracting is_dir(), append_file/dir(), and some fix in watch_directory_tree