Check if directory exists before trying to create it