Updating metadata and making sure the directory is there first.