@
MontyJ - you can regenerate the book folder metadata.opf files with the
calibredb backup_metadata subcommand.
To deal with "Extra Titles" etc, create an empty library with same custom columns as the problem library via the library Create/switch dialogue, then use the Copy to Library (with delete) tool to copy all the books from the 'problem library' to the new one. The books that are left in 'problem library' can be added en-masse using the Add Books one book per directory option.
Review your workflow. Check library errors like extra authors and titles, and missing metadata.opf files are almost invariably caused by using a file manager to add, rename, delete sub-directories and files within in the library directory tree.
BR