Check for folder before writing.