There's no need to check if director exists. Simply use -p flag with mkdir.