make search_dir script & mearge search_dir_function to main