Create the parent directory if it doesn't exist using the fix suggested by meletis