factor checkExistFileOrFolder