Use checkDirExist instead of stat