I don't know of any automated way to do this. We faced a somewhat similar situation awhile back when we had to reconfigure our sites to move all of our media files under the media folder for decentralized site maintenance (you can read about this in more detail in this thread.) I thought that perhaps I could come up with SQL scripts to do this, but our webmasters were able to get it all done without having to do that.
Sorry I can't be of more help.
Jamie