in reply to problem in checking if directory exists

Why not just invoke mkdir -p, or mkpath equivalent, instead of checking the existence before hand? Nothing is gained in doing that in two steps (unless somebody corrects me).