Refactor decision to create intermediate directories
Treat 404 errors as a cue to create intermediate directories too

Fixes #76