Fix placing files in directories that don't exist yet