Does calibredb --automerge, -m work?
If books with similar titles and authors are found, merge the incoming formats (files) automatically into existing book records. A value of "ignore" means duplicate formats are discarded. A value of "overwrite" means duplicate formats in the library are overwritten with the newly added files.
A value of "new_record" means duplicate formats are placed into a new book record.

the number in the containing Folder is the books {ID} if that helps