Clean install only affects the program binaries, not your library or settings.
When you moved the metadata.db, that made calibre recreate an empty one -- restore database would fix that. See the
FAQ: The list of books in calibre is blank!
But regenerating the database would only get you the same metadata.db as the one you moved after the previous restore.
I am
guessing the duplicate copies are slightly-differently-named ebook.FMT files in each book folder?
calibre won't add two of the same format.
If you have two different folders with the same books (means: has same id number at the end), then Restore Database should have showed a warning that some folders were ignored since they were duplicates
Restore will never delete duplicates!
If calibre knows about everything it should, and you merely want to rid yourself of extra (duplicate) files cluttering and taking up space, then use:
Library dropdown ==> Switch/create library ==>
Move current library to new location
calibre will move all files it knows about to the new location, creating a pristine, healthy library and leaving behind untracked junk.
You can then add or delete the leftovers as you see fit.