How to mkdir only if a dir does not already exist?

Posted by Spike Williams on Stack Overflow See other posts from Stack Overflow or by Spike Williams
Published on 2009-04-27T14:47:44Z Indexed on 2010/04/25 6:03 UTC
Read the original article Hit count: 227

Filed under:
|
|
|
|

I am writing a script to run under the korn shell on AIX. I'd like to use the mkdir command to create a directory. But the directory may already exist, in which case I don't want to do anything. So I want to either test to see that the directory doesn't exist, or suppress the "File exists" error that mkdir throws when it tries to create an existing directory.

Any thoughts on how best to do this?

© Stack Overflow or respective owner

Related posts about ksh

Related posts about shell