Migrating media attachements from a WordPress.Com blog

I first started blogging on a WordPress.Com hosted blog. After i bought my domain i knew that i had to move everything in an automated fashion, or else i’d kill myself. Luckily WordPress has the Export/Import features that saves a lot of time. It also imports media attachements (pictures) but not as i expected. For some strange reason, it copied some of the pictures but most of them were just linked to the old address. 

My former blog address was truicavictor.wordpress.com and i’ve noticed the links from the old blog in comparison with the new one:

  • truicavictor.files.wordpress.com/YYYY/MM/name.extension
  • truica-victor.com/wp-content/uploads/YYYY/MM/name.extension

After seeing this i knew that i had to:

  • replace “truicavictor.files.wordpress.com” with “truica-victor.com/wp-content/uploads” in the database
  • get all my pictures from the old blog

Replacing strings in the WordPress database tables can be done either by manually querying and inspecting each table (suicide) or either by using a tool that identifies each occurence of string in the database. I found a plugin that solved this problem and it’s called Search and Replace. After installing the plugin, you can find it in the Tools section from the dashboard.

Getting all my pictures from the old blog didn’t went that smooth. I had to manually open each media attachement from the Dashboard, download each of them and upload them via FTP to my new host. If somebody knows a better (automated) way of doing this please leave a comment.