Add the option to create the target directory
Currently the writing fails when the file target directory does not exists. To avoid code duplication it would be nice to add the option to the FileParams that allows enabling/disabling of the check and creating of the target directory.