search valid directory in -cd option