I would create a static method in a utility class which saves a file and automatically creates all necessary directories at the same time. The code inside the utility method may be a bit verbose, but this way, you can keep that ugly, verbose code out of your high-level application logic. And in future projects, you can always reuse the utility. After you split this code off into a utility method, it will also be easy to test in isolation.
I recommend you try to think in terms of building utilities and then using the utilities to build the actual application, rather than mixing detailed, low-level code in everywhere. The utilities you write may be useful on later projects, but that's not the primary goal: even if you only use a utility method on one project, and even if it is only called from one place in the higher-level code, it is still worth it if it helps make the higher-level code clearer. I don't remember which book helped me to get this concept; it may have been The Practice of Programming by Kernighan and Pike, or The Art of UNIX Programming by Raymond, or On Lisp by Graham -- or probably all three. (Of course, it's also important to know your language's standard library, so you don't start writing utilities which are already written for you.)