The API throws when the directories already exist, which is quite unexpected. This now changes the code to silently ignore these issues in the knowledge that the immediately following opening of files will fail with a nice error message.