finished prepare_directory