Changing locations of library stored in files?

I am in the process of moving some files across drives, and changing locations of the media.
However, it seems when I copy the content to a new location, it creates duplicates - as I would expect, instead of adding new items.
When I delete the original files though, the library is rescanned, and those who were initially listed as duplicates are now added as new items and going through automatic matching again.

Are there any files I can edit to change the location of the folders in the libraries? The files will be the same, I just want to change the location without having the content re-added as new content

There is only one way:

I took at look at the database, and I found old locations still stored here.
Is there any way to “wipe old data” from the database?

@stevencas said:
I took at look at the database, and I found old locations still stored here.
Is there any way to “wipe old data” from the database?

There is no need to wipe them out.

Just ‘edit’ your libraries, go to the ‘Add Folders’ tab
and remove old, obsolete folder paths from there

Then ‘Scan Library Files’
followed by ‘Empty trash’