append a slash to the directory if needed in mkdir