2

I have a heap of images inside MovableType, on an old server. There are plenty which have character entities like %20 to represent spaces.

I've used some plugins to import the images and change the URLs inside posts, but while MT can deal with /my%20dog.jpg, WP just shows a 404.

Assuming there's no way to get WP to display these images, and I have to rename them, what's the best way to:

  • Rename all the files (strip out character entities)
  • Rename all the URLs referenced in posts

I'm a little bit stuck here and not sure what the best way of solving this would be, whether via SSH and SQL queries, or otherwise.

1 Answer 1

1

You are going to need:

1. Total Commander (or anything else that allows you to rename massive numbers of files)

Probably the best file manager in the world (especially when it comes to handle uploads etc.), it's not free but the trial version should do the job. Just select all these images (they could be anywhere within Total Commander and choose "Multi-Rename tool (CTRL+M)" from "File" Menu.

In "Search for" field type: %20 then change it to anything you like within "Replace with" field (I guess the best choice would be: _).

Get Total Commander from: http://www.ghisler.com/

2. A simple SQL command.

UPDATE wp_posts SET post_content = replace(post_content,"%20","_");

It just "scans" every post for %20 and then simply replaces it with _

I hope it helps.

1
  • Thanks - I'll give that a go and see if it helps! Wish this could be done with htaccess/server side, though.
    – jontly
    Nov 6, 2011 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.