Test directory existence before creating it